home *** CD-ROM | disk | FTP | other *** search
/ Champak 145 / (Vol 145) Dec 21 2011.iso / Games / hanna-in-a-choppa.swf / scripts / frame_61 / DoAction.as
Encoding:
Text File  |  2011-12-21  |  143.9 KB  |  4,170 lines

  1. function Sounds(clip)
  2. {
  3.    if(clip == undefined)
  4.    {
  5.       trace("Sounds: Clip not found in constructor");
  6.    }
  7.    this.clip = clip;
  8.    clip.objSounds = this;
  9.    this.sounds = [];
  10.    this.groups = [];
  11.    this.loops = [];
  12.    this.muted = false;
  13.    clip.onEnterFrame = function()
  14.    {
  15.       this.objSounds.evtEnterFrame();
  16.    };
  17. }
  18. function Physics(baseClip, gravityX, gravityY, drag, collidableMasses, attractingMasses, framePaintCallback, defaultPaint)
  19. {
  20.    this.baseClip = baseClip;
  21.    this.gravityX = gravityX;
  22.    this.gravityY = gravityY;
  23.    this.drag = drag;
  24.    this.collidableMasses = !collidableMasses ? false : true;
  25.    this.attractingMasses = !attractingMasses ? false : true;
  26.    this.attractionScale = 100;
  27.    this.masses = [];
  28.    this.springs = [];
  29.    this.surfaces = [];
  30.    this.framePaintCallback = framePaintCallback;
  31.    this.defaultPaint = defaultPaint != undefined ? defaultPaint : true;
  32.    this.biggestMassRadius = 0;
  33.    this.paused = false;
  34.    this.baseClip.physics = this;
  35.    this.baseClip.onEnterFrame = function()
  36.    {
  37.       this.physics.step();
  38.    };
  39. }
  40. function massSort(a, b)
  41. {
  42.    return a.x > b.x;
  43. }
  44. function collisionSort(a, b)
  45. {
  46.    if(a.massA.idx == b.massA.idx)
  47.    {
  48.       return a.massB.idx > b.massB.idx;
  49.    }
  50.    return a.massA.idx > b.massA.idx;
  51. }
  52. function Mass(x, y, radius, fixed, physics, collisionSet)
  53. {
  54.    this.x = x;
  55.    this.y = y;
  56.    this.prevX = x;
  57.    this.prevY = y;
  58.    this.radius = radius;
  59.    this.radiusSquared = radius * radius;
  60.    this.fixed = fixed;
  61.    this.depth = physics.baseClip.getNextHighestDepth();
  62.    this.physics = physics;
  63.    this.collisionSet = collisionSet;
  64.    this.mass = 1;
  65.    this.friction = 0;
  66.    this.attractionMass = 0;
  67.    this.attractionMaxForce = 10;
  68.    this.extForceX = 0;
  69.    this.extForceY = 0;
  70.    this.hasHitSurface = false;
  71.    this.idx = this.physics.masses.length;
  72.    if(radius > physics.biggestMassRadius)
  73.    {
  74.       physics.biggestMassRadius = radius;
  75.    }
  76.    this.vx = 0;
  77.    this.vy = 0;
  78.    this.springs = [];
  79.    this.physics.masses.push(this);
  80.    if(this.physics.defaultPaint)
  81.    {
  82.       this.clip = this.physics.baseClip.createEmptyMovieClip("mass" + this.depth,this.depth);
  83.       this.clip.lineStyle(this.radius * 2,255,50);
  84.       this.clip.moveTo(0,0);
  85.       this.clip.lineTo(0,1);
  86.       this.clip.owner = this;
  87.    }
  88. }
  89. function Spring(mass1, mass2, physics, k, damperK)
  90. {
  91.    this.mass1 = mass1;
  92.    this.mass2 = mass2;
  93.    this.k = 0.8;
  94.    if(k != undefined)
  95.    {
  96.       this.k = k;
  97.    }
  98.    this.damperK = 0.2;
  99.    if(damperK != undefined)
  100.    {
  101.       this.damperK = damperK;
  102.    }
  103.    this.depth = physics.baseClip.getNextHighestDepth();
  104.    this.physics = physics;
  105.    this.mass1.springs.push(this);
  106.    this.mass2.springs.push(this);
  107.    this.physics.springs.push(this);
  108.    this.naturalLength = this.currentLength();
  109.    if(this.physics.defaultPaint)
  110.    {
  111.       this.clip = this.physics.baseClip.createEmptyMovieClip("spring" + this.depth,this.depth);
  112.       this.clip.owner = this;
  113.    }
  114. }
  115. function Surface(x1, y1, x2, y2, physics, restitution, friction)
  116. {
  117.    this.x1 = x1;
  118.    this.y1 = y1;
  119.    this.x2 = x2;
  120.    this.y2 = y2;
  121.    this.friction = 0.9;
  122.    this.restitution = 0.96;
  123.    if(friction != undefined)
  124.    {
  125.       this.friction = friction;
  126.    }
  127.    if(restitution != undefined)
  128.    {
  129.       this.restitution = restitution;
  130.    }
  131.    this.depth = physics.baseClip.getNextHighestDepth();
  132.    this.physics = physics;
  133.    this.physics.surfaces.push(this);
  134.    if(this.physics.defaultPaint)
  135.    {
  136.       this.clip = this.physics.baseClip.createEmptyMovieClip("surface" + this.depth,this.depth);
  137.       this.clip.owner = this;
  138.       this.paint();
  139.    }
  140.    this.update();
  141. }
  142. function SpringBox(x, y, w, h, vx, vy, cornerRadius, springConstant, mass, collisionSet, physics)
  143. {
  144.    this.physics = physics;
  145.    this.m_tl = new Mass(x - w / 2,y - h / 2,cornerRadius,false,physics,collisionSet);
  146.    this.m_tr = new Mass(x + w / 2,y - h / 2,cornerRadius,false,physics,collisionSet);
  147.    this.m_bl = new Mass(x - w / 2,y + h / 2,cornerRadius,false,physics,collisionSet);
  148.    this.m_br = new Mass(x + w / 2,y + h / 2,cornerRadius,false,physics,collisionSet);
  149.    this.m_tl.mass = mass;
  150.    this.m_tr.mass = mass;
  151.    this.m_bl.mass = mass;
  152.    this.m_br.mass = mass;
  153.    this.m_tl.vx = vx;
  154.    this.m_tr.vx = vx;
  155.    this.m_bl.vx = vx;
  156.    this.m_br.vx = vx;
  157.    this.m_tl.vy = vy;
  158.    this.m_tr.vy = vy;
  159.    this.m_bl.vy = vy;
  160.    this.m_br.vy = vy;
  161.    this.s1 = new Spring(this.m_tl,this.m_tr,physics,springConstant);
  162.    this.s2 = new Spring(this.m_tr,this.m_br,physics,springConstant);
  163.    this.s3 = new Spring(this.m_br,this.m_bl,physics,springConstant);
  164.    this.s4 = new Spring(this.m_bl,this.m_tl,physics,springConstant);
  165.    this.s5 = new Spring(this.m_tl,this.m_br,physics,springConstant);
  166.    this.s6 = new Spring(this.m_tr,this.m_bl,physics,springConstant);
  167.    this.frontLeft = this.m_tl;
  168.    this.frontRight = this.m_tr;
  169. }
  170. function SpringLine(x, y, dx, dy, vx, vy, cornerRadius, springConstant, mass, physics, collisionSet)
  171. {
  172.    this.physics = physics;
  173.    this.m_f = new Mass(x - dx / 2,y - dy / 2,cornerRadius,false,physics,collisionSet);
  174.    this.m_b = new Mass(x + dx / 2,y + dy / 2,cornerRadius,false,physics,collisionSet);
  175.    this.m_f.mass = mass;
  176.    this.m_b.mass = mass;
  177.    this.m_f.springItem = this;
  178.    this.m_b.springItem = this;
  179.    this.m_f.vx = vx;
  180.    this.m_f.vy = vy;
  181.    this.m_b.vx = vx;
  182.    this.m_b.vy = vy;
  183.    this.s1 = new Spring(this.m_f,this.m_b,physics,springConstant);
  184. }
  185. function makeSpringLine(mass_front, mass_back)
  186. {
  187.    var _loc1_ = {m_f:mass_front,m_b:mass_back};
  188.    _loc1_.s1 = new Spring(_loc1_.m_f,_loc1_.m_b,mass_front.physics,0.7);
  189.    _loc1_.getPosition = SpringLine.prototype.getPosition;
  190.    return _loc1_;
  191. }
  192. function addSurfaces(clip, instancePrefix, physics, restitution, friction)
  193. {
  194.    var _loc7_ = [];
  195.    var _loc6_ = 0;
  196.    var _loc1_ = clip[instancePrefix + _loc6_];
  197.    while(_loc1_ != undefined)
  198.    {
  199.       var _loc3_ = _loc1_.p1.holderToLocal(physics.baseClip);
  200.       var _loc2_ = _loc1_.p2.holderToLocal(physics.baseClip);
  201.       var _loc5_ = new Surface(_loc3_.x,_loc3_.y,_loc2_.x,_loc2_.y,physics,restitution,friction);
  202.       _loc1_._visible = false;
  203.       _loc7_.push(_loc5_);
  204.       _loc6_ = _loc6_ + 1;
  205.       _loc1_ = clip[instancePrefix + _loc6_];
  206.    }
  207.    return _loc7_;
  208. }
  209. function setupLevelIndicators(levelsClip)
  210. {
  211.    initLevelSO();
  212.    initAchievementsSO();
  213.    var _loc3_ = undefined;
  214.    var _loc5_ = 21;
  215.    var _loc4_ = 1;
  216.    while(_loc3_ = levelsClip["l" + _loc4_])
  217.    {
  218.       var _loc2_ = _root.arrLevels[_loc4_];
  219.       _loc3_.id = _loc4_;
  220.       _loc3_.gotoAndStop(!_loc2_.available ? "unavailable" : "available");
  221.       _loc3_.txtLevel.text = Maths.formatNum(_loc4_,2);
  222.       _loc3_.passed.gotoAndStop("unfinished");
  223.       if(_loc2_.passed)
  224.       {
  225.          _loc3_.passed.gotoAndStop("passed");
  226.       }
  227.       if(_loc2_.perfect)
  228.       {
  229.          _loc3_.passed.gotoAndStop("perfect");
  230.       }
  231.       if(_loc2_.fast)
  232.       {
  233.          _loc3_.passed.gotoAndStop("fast");
  234.       }
  235.       if(_loc2_.perfect && _loc2_.fast)
  236.       {
  237.          _loc3_.passed.gotoAndStop("perfectfast");
  238.       }
  239.       if(!_loc2_.passed && _loc2_.available && _loc4_ < _loc5_)
  240.       {
  241.          _loc5_ = _loc4_;
  242.       }
  243.       _loc4_ = _loc4_ + 1;
  244.    }
  245.    if(_root.workingOnLevel == undefined)
  246.    {
  247.       _root.workingOnLevel = _loc5_;
  248.    }
  249.    levelsClip["l" + _root.workingOnLevel].gotoAndStop("selected");
  250.    _root.levelTitle._alpha = 0;
  251.    levels.onEnterFrame = function()
  252.    {
  253.       _root.delay = _root.delay - 1;
  254.       _root.levelTitle._x = _root._xmouse;
  255.       _root.levelTitle._y = _root._ymouse;
  256.       if(_root.objTrans.transitioning)
  257.       {
  258.          return undefined;
  259.       }
  260.       if(Key.isDown(Keys.Enter))
  261.       {
  262.          _root.objTrans.goto("game");
  263.       }
  264.       if(Key.isDown(Keys.CursorLeft) || Key.isDown(Keys.A))
  265.       {
  266.          selectLevel(-1,0);
  267.       }
  268.       if(Key.isDown(Keys.CursorRight) || Key.isDown(Keys.D))
  269.       {
  270.          selectLevel(1,0);
  271.       }
  272.       if(Key.isDown(Keys.CursorUp) || Key.isDown(Keys.W))
  273.       {
  274.          selectLevel(0,-1);
  275.       }
  276.       if(Key.isDown(Keys.CursorDown) || Key.isDown(Keys.S))
  277.       {
  278.          selectLevel(0,1);
  279.       }
  280.    };
  281. }
  282. function rollOverLevel(id)
  283. {
  284.    _root.levelTitle.txtTitle.text = _root.arrLevels[id].title;
  285.    _root.levelTitle.fadeIn(0.5);
  286. }
  287. function rollOutLevel()
  288. {
  289.    _root.levelTitle.fadeOut(0.5);
  290. }
  291. function selectLevel(dx, dy)
  292. {
  293.    if(_root.delay > 0)
  294.    {
  295.       return undefined;
  296.    }
  297.    _root.delay = 6;
  298.    var _loc8_ = _root.arrLevels[_root.workingOnLevel];
  299.    var _loc12_ = _root.levels["l" + _loc8_.id]._x;
  300.    var _loc11_ = _root.levels["l" + _loc8_.id]._y;
  301.    var _loc9_ = 0;
  302.    var _loc10_ = _loc8_.id;
  303.    var _loc3_ = 0;
  304.    while(_loc3_ < _loc8_.links.length)
  305.    {
  306.       var _loc2_ = _root.arrLevels[_loc8_.links[_loc3_]];
  307.       if(_loc2_.available)
  308.       {
  309.          var _loc5_ = _root.levels["l" + _loc2_.id]._x - _loc12_;
  310.          var _loc4_ = _root.levels["l" + _loc2_.id]._y - _loc11_;
  311.          var _loc7_ = Maths.vectorLength(_loc5_,_loc4_);
  312.          _loc5_ /= _loc7_;
  313.          _loc4_ /= _loc7_;
  314.          var _loc6_ = Maths.dotProduct(_loc5_,_loc4_,dx,dy);
  315.          if(_loc6_ >= 0.4)
  316.          {
  317.             if(_loc6_ > _loc9_)
  318.             {
  319.                _loc9_ = _loc6_;
  320.                _loc10_ = _loc2_.id;
  321.             }
  322.          }
  323.       }
  324.       _loc3_ = _loc3_ + 1;
  325.    }
  326.    deselectLevels(_loc10_);
  327.    _root.levels["l" + _loc10_].gotoAndStop("selected");
  328. }
  329. function setupNeverPress(clip)
  330. {
  331.    clip.item = 0;
  332.    clip.btnNeverPress.clip = clip;
  333.    clip.btnNeverPress.onRelease = nextNeverPress;
  334.    clip.txtNeverPress.text = arrNeverPress[0];
  335. }
  336. function nextNeverPress()
  337. {
  338.    this.clip.item = this.clip.item + 1;
  339.    if(this.clip.item < arrNeverPress.length)
  340.    {
  341.       this.clip.txtNeverPress.text = arrNeverPress[this.clip.item];
  342.       _root.objSounds.play("buzz");
  343.    }
  344.    else
  345.    {
  346.       _root.achieved(14);
  347.       _root.objSounds.play("cry");
  348.       switch(Maths.randomInt(0,4))
  349.       {
  350.          case 0:
  351.             this.clip.txtNeverPress.text = "*cry*";
  352.             break;
  353.          case 1:
  354.             this.clip.txtNeverPress.text = "*waa*";
  355.             break;
  356.          case 2:
  357.             this.clip.txtNeverPress.text = "*sob*";
  358.             break;
  359.          case 3:
  360.             this.clip.txtNeverPress.text = "*sniffle*";
  361.             break;
  362.          case 4:
  363.             this.clip.txtNeverPress.text = "*weep*";
  364.       }
  365.       this.clip.tear.gotoAndPlay("cry");
  366.    }
  367. }
  368. function setupAchievements()
  369. {
  370.    var _loc2_ = 1;
  371.    while(_loc2_ < _root.arrAchievements.length)
  372.    {
  373.       clip = _root["a" + _loc2_];
  374.       if(_root.arrAchievements[_loc2_].complete)
  375.       {
  376.          clip.box.gotoAndStop("on");
  377.       }
  378.       clip._alpha = 0;
  379.       clip.fadeIn(1,"linear",Maths.randomNum(0,1.5));
  380.       _loc2_ = _loc2_ + 1;
  381.    }
  382. }
  383. function achieved(id)
  384. {
  385.    trace("Achievement " + id + " gained");
  386.    if(_root.arrAchievements[id].complete)
  387.    {
  388.       return undefined;
  389.    }
  390.    _root.trackPoint("Achievement_" + id);
  391.    _root.kongregateStats.submit("Achievement" + id,1);
  392.    _root.arrAchievements[id].complete = true;
  393.    var _loc5_ = SharedObject.getLocal("hannainachoppa");
  394.    _loc5_.data.arrAchievements = _root.arrAchievements;
  395.    _loc5_.flush();
  396.    _root.achievement.gotoAndPlay("anim");
  397.    _root.achievement.txtAchievementName.text = achievementName(id);
  398.    var _loc3_ = 0;
  399.    var _loc2_ = 0;
  400.    while(_loc2_ < _root.arrAchievements.length)
  401.    {
  402.       if(_root.arrAchievements[_loc2_].complete)
  403.       {
  404.          _loc3_ = _loc3_ + 1;
  405.       }
  406.       _loc2_ = _loc2_ + 1;
  407.    }
  408.    if(_loc3_ >= _root.arrAchievements.length - 2)
  409.    {
  410.       achieved(13);
  411.       Mouse.show();
  412.       _root.objTrans.goto("win");
  413.    }
  414. }
  415. function deselectLevels(exceptID)
  416. {
  417.    var _loc3_ = undefined;
  418.    var _loc2_ = 1;
  419.    while(_loc3_ = _root.levels["l" + _loc2_])
  420.    {
  421.       if(_loc2_ != exceptID)
  422.       {
  423.          _loc3_.gotoAndStop(!_root.arrLevels[_loc2_].available ? "unavailable" : "available");
  424.       }
  425.       _loc2_ = _loc2_ + 1;
  426.    }
  427.    _root.curLevelID = exceptID;
  428.    _root.workingOnLevel = curLevelID;
  429. }
  430. function passedLevel(id, perfect, fast)
  431. {
  432.    var _loc3_ = _root.arrLevels[id];
  433.    _loc3_.passed = true;
  434.    if(perfect)
  435.    {
  436.       _loc3_.perfect = true;
  437.    }
  438.    if(fast)
  439.    {
  440.       _loc3_.fast = true;
  441.    }
  442.    reportAllStatistics(false);
  443.    _root.workingOnLevel = undefined;
  444.    var _loc2_ = 0;
  445.    while(_loc2_ < _loc3_.links.length)
  446.    {
  447.       _root.arrLevels[_loc3_.links[_loc2_]].available = true;
  448.       _loc2_ = _loc2_ + 1;
  449.    }
  450.    var _loc4_ = SharedObject.getLocal("hannainachoppa");
  451.    _loc4_.data.arrLevels = _root.arrLevels;
  452.    _loc4_.flush();
  453. }
  454. function reportAllStatistics(includeAchievements)
  455. {
  456.    var _loc5_ = 0;
  457.    var _loc4_ = 0;
  458.    var _loc6_ = 0;
  459.    var _loc7_ = 0;
  460.    trace("Reporting stats to Kongregate");
  461.    var _loc3_ = SharedObject.getLocal("hannainachoppa");
  462.    if(_loc3_.data.arrAchievements != undefined)
  463.    {
  464.       var _loc2_ = 1;
  465.       while(_loc2_ < _loc3_.data.arrAchievements.length)
  466.       {
  467.          if(_loc3_.data.arrAchievements[_loc2_].complete)
  468.          {
  469.             if(includeAchievements)
  470.             {
  471.                _root.kongregateStats.submit("Achievement" + _loc2_,1);
  472.                trace("  Achievement" + _loc2_ + " = 1");
  473.             }
  474.             _loc7_ = _loc7_ + 1;
  475.          }
  476.          _loc2_ = _loc2_ + 1;
  477.       }
  478.    }
  479.    if(_loc3_.data.arrLevels != undefined)
  480.    {
  481.       _loc2_ = 1;
  482.       while(_loc2_ < _loc3_.data.arrLevels.length)
  483.       {
  484.          if(_loc3_.data.arrLevels[_loc2_].passed)
  485.          {
  486.             _loc5_ = _loc5_ + 1;
  487.          }
  488.          if(_loc3_.data.arrLevels[_loc2_].perfect)
  489.          {
  490.             _loc6_ = _loc6_ + 1;
  491.          }
  492.          if(_loc3_.data.arrLevels[_loc2_].fast)
  493.          {
  494.             _loc4_ = _loc4_ + 1;
  495.          }
  496.          _loc2_ = _loc2_ + 1;
  497.       }
  498.    }
  499.    trace("  CompletedLevels        = " + _loc5_);
  500.    trace("  CompletedFastLevels    = " + _loc4_);
  501.    trace("  CompletedPerfectLevels = " + _loc6_);
  502.    trace("  CompletedAchievements  = " + _loc7_);
  503.    _root.kongregateStats.submit("CompletedLevels",_loc5_);
  504.    _root.kongregateStats.submit("CompletedFastLevels",_loc4_);
  505.    _root.kongregateStats.submit("CompletedPerfectLevels",_loc6_);
  506.    _root.kongregateStats.submit("CompletedAchievements",_loc7_);
  507. }
  508. function initLevelSO()
  509. {
  510.    var _loc2_ = SharedObject.getLocal("hannainachoppa");
  511.    if(_loc2_.data.arrLevels == undefined)
  512.    {
  513.       _loc2_.data.arrLevels = [{dummy:true},{id:1,available:false,passed:false,perfect:false,fast:false,par:200,title:"Learning to Fly",links:[2,4]},{id:2,available:false,passed:false,perfect:false,fast:false,par:500,title:"Finesse of Flight",links:[1,3,5]},{id:3,available:false,passed:false,perfect:false,fast:false,par:450,title:"A Weighty Problem",links:[2,6]},{id:4,available:false,passed:false,perfect:false,fast:false,par:200,title:"Blustery Day",links:[1,5]},{id:5,available:false,passed:false,perfect:false,fast:false,par:400,title:"Gone Fishin\'",links:[2,4,6,7]},{id:6,available:false,passed:false,perfect:false,fast:false,par:700,title:"Pulling The Plug",links:[3,5]},{id:7,available:false,passed:false,perfect:false,fast:false,par:750,title:"Flight of the Bumblebee",links:[5,8,9,10]},{id:8,available:false,passed:false,perfect:false,fast:false,par:400,title:"Fan-tastic",links:[7]},{id:9,available:false,passed:false,perfect:false,fast:false,par:1200,title:"Raining Hard on a Tiny Planetoid",links:[7,10,11,12]},{id:10,available:false,passed:false,perfect:false,fast:false,par:700,title:"Cement Mixer",links:[7,9,13,11]},{id:11,available:false,passed:false,perfect:false,fast:false,par:250,title:"Yosamite SAM-Site",links:[9,12,14,10]},{id:12,available:false,passed:false,perfect:false,fast:false,par:540,title:"Beat the Lift",links:[9,11]},{id:13,available:false,passed:false,perfect:false,fast:false,par:650,title:"Magneto Completo",links:[10,15]},{id:14,available:false,passed:false,perfect:false,fast:false,par:2000,title:"Like Herding Cats, Erm, But With Sheep",links:[11,15,18]},{id:15,available:false,passed:false,perfect:false,fast:false,par:370,title:"Enclosed Box of Goo",links:[14,16,17,13]},{id:16,available:false,passed:false,perfect:false,fast:false,par:3500,title:"Rescue at Sea",links:[15,19,17]},{id:17,available:false,passed:false,perfect:false,fast:false,par:200,title:"Entrapment",links:[15,18,19,16]},{id:18,available:false,passed:false,perfect:false,fast:false,par:2000,title:"Running With Scissors",links:[14,17]},{id:19,available:false,passed:false,perfect:false,fast:false,par:2000,title:"The Crush-O-Tron",links:[17,20,16]},{id:20,available:false,passed:false,perfect:false,fast:false,par:500,title:"Deja Vu?",links:[19,21]},{id:21,available:false,passed:false,perfect:false,fast:false,par:4500,title:"The Cake is a Lie",links:[20]}];
  514.       _loc2_.data.arrLevels[1].available = true;
  515.       _loc2_.flush();
  516.    }
  517.    _root.arrLevels = _loc2_.data.arrLevels;
  518. }
  519. function initAchievementsSO()
  520. {
  521.    var _loc2_ = SharedObject.getLocal("hannainachoppa");
  522.    if(_loc2_.data.arrAchievements == undefined)
  523.    {
  524.       _loc2_.data.arrAchievements = [{dummy:true},{id:1,complete:false},{id:2,complete:false},{id:3,complete:false},{id:4,complete:false},{id:5,complete:false},{id:6,complete:false},{id:7,complete:false},{id:8,complete:false},{id:9,complete:false},{id:10,complete:false},{id:11,complete:false},{id:12,complete:false},{id:13,complete:false},{id:14,complete:false},{id:15,complete:false}];
  525.       _loc2_.flush();
  526.    }
  527.    _root.arrAchievements = _loc2_.data.arrAchievements;
  528. }
  529. function achievementName(id)
  530. {
  531.    switch(id)
  532.    {
  533.       case 1:
  534.          return "HOVERCHAMP";
  535.       case 2:
  536.          return "SERVICES TO SUMMER";
  537.       case 3:
  538.          return "MISSILE PROOF";
  539.       case 4:
  540.          return "SHEEP FRIENDLY";
  541.       case 5:
  542.          return "TOWER BUDDIE";
  543.       case 6:
  544.          return "TOWER SUPERBUDDIE";
  545.       case 7:
  546.          return "BAKER OF CAKE";
  547.       case 8:
  548.          return "BEEN THERE DONE THAT";
  549.       case 9:
  550.          return "PRETTY PERFECT";
  551.       case 10:
  552.          return "PERFECTIONIST";
  553.       case 11:
  554.          return "PRETTY BRISK";
  555.       case 12:
  556.          return "UBERFAST";
  557.       case 13:
  558.          return "OVERACHIEVER";
  559.       case 14:
  560.          return "PRESSER OF BUTTONS";
  561.       case 15:
  562.          return "DEV-FRIEND";
  563.       default:
  564.          return "UNKNOWN";
  565.    }
  566. }
  567. function initSounds()
  568. {
  569.    _root.objSounds = new Sounds(_root.soundHolder);
  570.    _root.objSounds.registerSound("blade0");
  571.    _root.objSounds.registerSound("blade1");
  572.    _root.objSounds.registerSound("blade2");
  573.    _root.objSounds.registerSound("blade3");
  574.    _root.objSounds.registerSound("blade4");
  575.    _root.objSounds.registerSound("blade5");
  576.    _root.objSounds.registerSound("blade6");
  577.    _root.objSounds.registerSound("blade7");
  578.    _root.objSounds.registerSound("blade8");
  579.    _root.objSounds.registerSound("blade9");
  580.    _root.objSounds.registerSound("blade10");
  581.    _root.objSounds.registerSound("blade11");
  582.    _root.objSounds.registerSound("blade12");
  583.    _root.objSounds.registerSound("blade13");
  584.    _root.objSounds.registerSound("blade14");
  585.    _root.objSounds.registerSound("blade15");
  586.    _root.objSounds.registerSound("blade16");
  587.    _root.objSounds.registerSound("blade17");
  588.    _root.objSounds.registerSound("blade18");
  589.    _root.objSounds.registerSound("blade19");
  590.    _root.objSounds.registerSound("blade20");
  591.    _root.objSounds.registerGroup("blade",["blade0","blade1","blade2","blade3","blade4","blade5","blade6","blade7","blade8","blade9","blade10","blade11","blade12","blade13","blade14","blade15","blade16","blade17","blade18","blade19","blade20"]);
  592.    _root.objSounds.registerSound("bee-buzz");
  593.    _root.objSounds.registerSound("bee-squish-1");
  594.    _root.objSounds.registerSound("bee-squish-2");
  595.    _root.objSounds.registerSound("bee-squish-3");
  596.    _root.objSounds.registerSound("bee-squish-4");
  597.    _root.objSounds.registerGroup("bee-squish",["bee-squish-1","bee-squish-2","bee-squish-3","bee-squish-4"]);
  598.    _root.objSounds.registerSound("baa1");
  599.    _root.objSounds.registerSound("baa2");
  600.    _root.objSounds.registerSound("baa3");
  601.    _root.objSounds.registerSound("baa4");
  602.    _root.objSounds.registerSound("baa5");
  603.    _root.objSounds.registerGroup("baa",["baa1","baa2","baa3","baa4","baa5"]);
  604.    _root.objSounds.registerSound("cry1");
  605.    _root.objSounds.registerSound("cry2");
  606.    _root.objSounds.registerSound("cry3");
  607.    _root.objSounds.registerSound("cry4");
  608.    _root.objSounds.registerSound("cry5");
  609.    _root.objSounds.registerSound("cry6");
  610.    _root.objSounds.registerGroup("cry",["cry1","cry2","cry3","cry4","cry5","cry6"]);
  611.    _root.objSounds.registerSound("clink1");
  612.    _root.objSounds.registerSound("clink2");
  613.    _root.objSounds.registerSound("clink3");
  614.    _root.objSounds.registerSound("clink4");
  615.    _root.objSounds.registerGroup("clink",["clink1","clink2","clink3","clink4"]);
  616.    _root.objSounds.registerGroup("clunk",["clink3","clink4"]);
  617.    _root.objSounds.registerSound("music");
  618.    _root.objSounds.registerSound("buzz",10);
  619.    _root.objSounds.registerSound("achievement",60);
  620.    _root.objSounds.registerSound("cake-mix");
  621.    _root.objSounds.registerSound("net-fall");
  622.    _root.objSounds.registerSound("rollover-tick");
  623.    _root.objSounds.registerSound("rollover-tock");
  624.    _root.objSounds.registerSound("sam-hit");
  625.    _root.objSounds.registerSound("sam-launch");
  626.    _root.objSounds.registerSound("switch");
  627.    _root.objSounds.registerSound("trans-hide");
  628.    _root.objSounds.registerSound("trans-reveal");
  629.    _root.objSounds.registerSound("wind-loop");
  630.    _root.objSounds.registerSound("crushotron-rumble");
  631.    _root.objSounds.registerSound("crushotron-bang");
  632.    _root.objSounds.registerSound("scissors");
  633.    _root.objSounds.registerSound("ratchet-loop");
  634.    _root.objSounds.registerSound("winch-deploy");
  635.    _root.objSounds.registerSound("winch-attach",60);
  636.    _root.objSounds.registerSound("winch-retract");
  637.    _root.objSounds.registerSound("voice-cake");
  638.    _root.objSounds.registerSound("voice-butter");
  639.    _root.objSounds.registerSound("voice-chocolate");
  640.    _root.objSounds.registerSound("voice-eggs");
  641.    _root.objSounds.registerSound("voice-flour");
  642.    _root.objSounds.registerSound("voice-sugar");
  643.    _root.objSounds.registerSound("voice-boom");
  644.    _root.objSounds.registerSound("voice-crashed");
  645.    _root.objSounds.registerSound("voice-noooo");
  646.    _root.objSounds.registerSound("voice-ouch");
  647.    _root.objSounds.registerSound("voice-ow");
  648.    _root.objSounds.registerSound("voice-watchit");
  649.    _root.objSounds.registerGroup("crashed",["voice-boom","voice-crashed","voice-noooo","voice-ouch","voice-ow","voice-watchit"]);
  650.    _root.objSounds.registerSound("voice-complete");
  651.    _root.objSounds.registerSound("voice-perfect");
  652.    _root.objSounds.registerSound("voice-reallyfast");
  653.    _root.objSounds.registerSound("voice-title");
  654. }
  655. function ChoppaGame(clip)
  656. {
  657.    this.clip = clip;
  658.    this.clip.objGame = this;
  659.    this.initialise();
  660. }
  661. stop();
  662. Mouse.show();
  663. _root.objSounds.stop("music");
  664. var Maths = new Object();
  665. Maths.randomNum = function(minNum, maxNum)
  666. {
  667.    return Math.random() * (maxNum - minNum) + minNum;
  668. };
  669. Maths.randomInt = function(minNum, maxNum)
  670. {
  671.    return Math.round(Math.random() * (maxNum - minNum) + minNum);
  672. };
  673. Maths.vectorLength = function(dx, dy)
  674. {
  675.    return Math.sqrt(dx * dx + dy * dy);
  676. };
  677. Maths.distance = function(x1, y1, x2, y2)
  678. {
  679.    var _loc2_ = x1 - x2;
  680.    var _loc1_ = y1 - y2;
  681.    return Maths.vectorLength(_loc2_,_loc1_);
  682. };
  683. Maths.vectorLengthSquared = function(dx, dy)
  684. {
  685.    return dx * dx + dy * dy;
  686. };
  687. Maths.distanceSquared = function(x1, y1, x2, y2)
  688. {
  689.    var _loc2_ = x1 - x2;
  690.    var _loc1_ = y1 - y2;
  691.    return Maths.vectorLengthSquared(_loc2_,_loc1_);
  692. };
  693. Maths.angleBetween = function(x1, y1, x2, y2)
  694. {
  695.    var _loc2_ = x1 * x2 + y1 * y2;
  696.    var _loc1_ = Maths.vectorLength(x1,y1) * Maths.vectorLength(x2,y2);
  697.    return Math.acos(_loc2_ / _loc1_);
  698. };
  699. Maths.dotProduct = function(ax, ay, bx, by)
  700. {
  701.    return ax * bx + ay * by;
  702. };
  703. Maths.vectorIntersect = function(v1, v2)
  704. {
  705.    var _loc3_ = {dx:v2.x - v1.x,dy:v2.y - v1.y};
  706.    v1.len = Maths.vectorLength(v1.dx,v1.dy);
  707.    v2.len = Maths.vectorLength(v2.dx,v2.dy);
  708.    v1.nx = v1.dx / v1.len;
  709.    v1.ny = v1.dy / v1.len;
  710.    v2.nx = v2.dx / v2.len;
  711.    v2.ny = v2.dy / v2.len;
  712.    var _loc4_ = Maths.vectorPerp(_loc3_,v2) / Maths.vectorPerp(v1,v2);
  713.    if(v1.nx == v2.nx && v1.ny == v2.ny || v1.nx == - v2.nx && v1.ny == - v2.ny)
  714.    {
  715.       _loc4_ = 1000000;
  716.    }
  717.    return {x:v1.x + v1.dx * _loc4_,y:v1.y + v1.dy * _loc4_,t:_loc4_};
  718. };
  719. Maths.vectorPerp = function(v1, v2)
  720. {
  721.    return (- v1.dy) * v2.dx + v1.dx * v2.dy;
  722. };
  723. Maths.vectorProject = function(v1, v2)
  724. {
  725.    var _loc2_ = Maths.vectorLength(v2.dx,v2.dy);
  726.    var _loc4_ = v2.dx / _loc2_;
  727.    var _loc3_ = v2.dy / _loc2_;
  728.    var _loc5_ = Maths.dotProduct(v1.dx,v1.dy,_loc4_,_loc3_);
  729.    return {x:v2.x,y:v2.y,dx:_loc4_ * _loc5_,dy:_loc3_ * _loc5_};
  730. };
  731. Maths.formatNum = function(num, leadingDigits, decimalDigits)
  732. {
  733.    var _loc2_ = "" + Math.floor(num);
  734.    while(_loc2_.length < leadingDigits)
  735.    {
  736.       _loc2_ = "0" + _loc2_;
  737.    }
  738.    if(decimalDigits != undefined)
  739.    {
  740.       var _loc1_ = Math.abs(num) - Math.floor(Math.abs(num));
  741.       _loc1_ *= 10 ^ decimalDigits;
  742.       _loc1_ = Math.floor(_loc1_);
  743.       _loc1_ = "" + _loc1_;
  744.       while(_loc1_.length < decimalDigits)
  745.       {
  746.          _loc1_ += "0";
  747.       }
  748.       _loc2_ = _loc2_ + "." + _loc1_;
  749.    }
  750.    return _loc2_;
  751. };
  752. Maths.degToRad = function(degs)
  753. {
  754.    return degs * 0.017453292519943295;
  755. };
  756. Maths.radToDeg = function(rads)
  757. {
  758.    return rads * 57.29577951308232;
  759. };
  760. MovieClip.prototype.drawCross = function(x, y, colour)
  761. {
  762.    if(colour != undefined)
  763.    {
  764.       this.lineStyle(1,colour,100);
  765.    }
  766.    else
  767.    {
  768.       this.lineStyle(1,16711935,100);
  769.    }
  770.    var _loc2_ = 7;
  771.    this.moveTo(x - _loc2_,y);
  772.    this.lineTo(x + _loc2_,y);
  773.    this.moveTo(x,y - _loc2_);
  774.    this.lineTo(x,y + _loc2_);
  775. };
  776. MovieClip.prototype.drawVector = function(v, scale, colour)
  777. {
  778.    if(colour != undefined)
  779.    {
  780.       this.lineStyle(1,colour,100);
  781.    }
  782.    else
  783.    {
  784.       this.lineStyle(1,65280,100);
  785.    }
  786.    if(scale == undefined)
  787.    {
  788.       scale = 1;
  789.    }
  790.    this.moveTo(v.x,v.y);
  791.    this.lineTo(v.x + v.dx * scale,v.y + v.dy * scale);
  792. };
  793. MovieClip.prototype.curvedRectangle = function(p_nX1, p_nY1, p_nX2, p_nY2, p_nR)
  794. {
  795.    var _loc2_ = p_nR != undefined ? p_nR : 0;
  796.    var _loc7_ = _loc2_ * 2;
  797.    var _loc10_ = Math.abs(p_nX2 - p_nX1) - _loc7_;
  798.    var _loc8_ = Math.abs(p_nY2 - p_nY1) - _loc7_;
  799.    this.moveTo(p_nX1 + _loc2_,p_nY1);
  800.    this.lineTo(p_nX2 - _loc2_,p_nY1);
  801.    this.curveTo(p_nX2,p_nY1,p_nX2,p_nY1 + _loc2_);
  802.    this.lineTo(p_nX2,p_nY2 - _loc2_);
  803.    this.curveTo(p_nX2,p_nY2,p_nX2 - _loc2_,p_nY2);
  804.    this.lineTo(p_nX1 + _loc2_,p_nY2);
  805.    this.curveTo(p_nX1,p_nY2,p_nX1,p_nY2 - _loc2_);
  806.    this.lineTo(p_nX1,p_nY1 + _loc2_);
  807.    this.curveTo(p_nX1,p_nY1,p_nX1 + _loc2_,p_nY1);
  808. };
  809. MovieClip.prototype.drawSquare = function(x, y, w, h)
  810. {
  811.    this.moveTo(x,y);
  812.    this.lineTo(x + w,y);
  813.    this.lineTo(x + w,y + h);
  814.    this.lineTo(x,y + h);
  815.    this.lineTo(x,y);
  816. };
  817. MovieClip.prototype.drawFilledSquare = function(x, y, w, h, colour, alpha)
  818. {
  819.    this.beginFill(colour,alpha);
  820.    this.drawSquare(x,y,w,h);
  821.    this.endFill();
  822. };
  823. MovieClip.prototype.drawCircle = function(x, y, r)
  824. {
  825.    var _loc6_ = r * 0.41421356237309515;
  826.    var _loc5_ = r * 1.4142135623730951 / 2;
  827.    this.moveTo(x + r,y);
  828.    this.curveTo(x + r,y + _loc6_,x + _loc5_,y + _loc5_);
  829.    this.curveTo(x + _loc6_,y + r,x,y + r);
  830.    this.curveTo(x - _loc6_,y + r,x - _loc5_,y + _loc5_);
  831.    this.curveTo(x - r,y + _loc6_,x - r,y);
  832.    this.curveTo(x - r,y - _loc6_,x - _loc5_,y - _loc5_);
  833.    this.curveTo(x - _loc6_,y - r,x,y - r);
  834.    this.curveTo(x + _loc6_,y - r,x + _loc5_,y - _loc5_);
  835.    this.curveTo(x + r,y - _loc6_,x + r,y);
  836. };
  837. MovieClip.prototype.drawFilledCircle = function(x, y, r, colour, alpha)
  838. {
  839.    this.beginFill(colour,alpha);
  840.    this.drawCircle(x,y,r);
  841.    this.endFill();
  842. };
  843. MovieClip.prototype.drawCircleSegment = function(x, y, r, startAngle, endAngle, stepAngle)
  844. {
  845.    degToRad = 0.017453292519943295;
  846.    while(endAngle < startAngle)
  847.    {
  848.       endAngle += 360;
  849.    }
  850.    this.moveTo(x,y);
  851.    this.lineTo(x + r * Math.cos(startAngle * degToRad),x + r * Math.sin(startAngle * degToRad));
  852.    var _loc2_ = startAngle + stepAngle;
  853.    while(_loc2_ < endAngle - stepAngle)
  854.    {
  855.       var _loc3_ = _loc2_ * degToRad;
  856.       this.lineTo(x + r * Math.cos(_loc3_),x + r * Math.sin(_loc3_));
  857.       _loc2_ += stepAngle;
  858.    }
  859.    this.lineTo(x + r * Math.cos(endAngle * degToRad),x + r * Math.sin(endAngle * degToRad));
  860.    this.lineTo(x,y);
  861. };
  862. MovieClip.prototype.drawFilledCircleSegment = function(x, y, r, startAngle, endAngle, stepAngle, colour, alpha)
  863. {
  864.    this.beginFill(colour,alpha);
  865.    this.drawCircleSegment(x,y,r,startAngle,endAngle,stepAngle);
  866.    this.endFill();
  867. };
  868. MovieClip.prototype.drawSmoothCurveThroughPoints = function(wibbleFactor, startAngle, points)
  869. {
  870.    this.moveTo(points[0].x,points[0].y);
  871.    var _loc13_ = points[0].x - Math.cos(3.141592653589793 * startAngle / 180);
  872.    var _loc12_ = points[0].y - Math.sin(3.141592653589793 * startAngle / 180);
  873.    var _loc2_ = 1;
  874.    while(_loc2_ < points.length)
  875.    {
  876.       var _loc5_ = points[_loc2_ - 1].x - _loc13_;
  877.       var _loc4_ = points[_loc2_ - 1].y - _loc12_;
  878.       var _loc8_ = Maths.vectorLength(_loc5_,_loc4_);
  879.       var _loc10_ = points[_loc2_ - 1].x - points[_loc2_].x;
  880.       var _loc9_ = points[_loc2_ - 1].y - points[_loc2_].y;
  881.       var _loc11_ = Maths.vectorLength(_loc10_,_loc9_);
  882.       cScale = 0;
  883.       if(_loc8_ != 0)
  884.       {
  885.          cScale = (0.5 + wibbleFactor) * _loc11_ / _loc8_;
  886.       }
  887.       var _loc7_ = points[_loc2_ - 1].x + _loc5_ * cScale;
  888.       var _loc6_ = points[_loc2_ - 1].y + _loc4_ * cScale;
  889.       this.curveTo(_loc7_,_loc6_,points[_loc2_].x,points[_loc2_].y);
  890.       _loc13_ = _loc7_;
  891.       _loc12_ = _loc6_;
  892.       _loc2_ = _loc2_ + 1;
  893.    }
  894. };
  895. MovieClip.prototype.holderToLocal = function(clip)
  896. {
  897.    var _loc2_ = {x:0,y:0};
  898.    this.localToGlobal(_loc2_);
  899.    clip.globalToLocal(_loc2_);
  900.    return _loc2_;
  901. };
  902. MovieClip.prototype.holderToGlobal = function()
  903. {
  904.    var _loc2_ = {x:0,y:0};
  905.    this.localToGlobal(_loc2_);
  906.    return _loc2_;
  907. };
  908. MovieClip.prototype.makeSound = function(soundLinkage, depth)
  909. {
  910.    var _loc2_ = this.createEmptyMovieClip("soundClip_" + soundLinkage + "_" + depth + "_" + Math.floor(Maths.randomNum(1000000,9000000)),depth);
  911.    _loc2_.sound = new Sound(_loc2_);
  912.    _loc2_.sound.attachSound(soundLinkage);
  913.    _loc2_.sound.sourceClip = _loc2_;
  914.    return _loc2_.sound;
  915. };
  916. var Keys = new Object();
  917. Keys.LeftMouse = 1;
  918. Keys._mouseDown = false;
  919. Keys.onMouseDown = function()
  920. {
  921.    this._mouseDown = true;
  922. };
  923. Keys.onMouseUp = function()
  924. {
  925.    this._mouseDown = false;
  926. };
  927. Mouse.addListener(Keys);
  928. Keys.mouseDown = function()
  929. {
  930.    return this._mouseDown;
  931. };
  932. Keys.CursorLeft = 37;
  933. Keys.CursorRight = 39;
  934. Keys.CursorUp = 38;
  935. Keys.CursorDown = 40;
  936. Keys.Escape = 27;
  937. Keys.Backspace = 8;
  938. Keys.Tab = 9;
  939. Keys.Enter = 13;
  940. Keys.Shift = 16;
  941. Keys.Control = 17;
  942. Keys.Alt = 18;
  943. Keys.CapsLock = 20;
  944. Keys.Spacebar = 32;
  945. Keys.PageUp = 33;
  946. Keys.PageDown = 34;
  947. Keys.End = 35;
  948. Keys.Home = 36;
  949. Keys.PrintScr = 44;
  950. Keys.ScrollLock = 145;
  951. Keys.Pause = 19;
  952. Keys.Insert = 45;
  953. Keys.Delete = 46;
  954. Keys.NumLock = 144;
  955. Keys.Semicolon = 186;
  956. Keys.Equals = 187;
  957. Keys.Minus = 189;
  958. Keys.Slash = 191;
  959. Keys.Apostrophe = 192;
  960. Keys.BackTick = 223;
  961. Keys.BackSlash = 220;
  962. Keys.Hash = 222;
  963. Keys.Comma = 188;
  964. Keys.Period = 190;
  965. Keys.SquareOpen = 219;
  966. Keys.SquareClose = 221;
  967. Keys.F1 = 112;
  968. Keys.F2 = 113;
  969. Keys.F3 = 114;
  970. Keys.F4 = 115;
  971. Keys.F5 = 116;
  972. Keys.F6 = 117;
  973. Keys.F7 = 118;
  974. Keys.F8 = 119;
  975. Keys.F9 = 120;
  976. Keys.F10 = undefined;
  977. Keys.F11 = 122;
  978. Keys.F12 = 123;
  979. Keys.Num0 = 96;
  980. Keys.Num1 = 97;
  981. Keys.Num2 = 98;
  982. Keys.Num3 = 99;
  983. Keys.Num4 = 100;
  984. Keys.Num5 = 101;
  985. Keys.Num6 = 102;
  986. Keys.Num7 = 103;
  987. Keys.Num8 = 104;
  988. Keys.Num9 = 105;
  989. Keys.NumMultiply = 106;
  990. Keys.NumAdd = 107;
  991. Keys.NumEnter = 13;
  992. Keys.NumMinus = 109;
  993. Keys.NumPeriod = 110;
  994. Keys.NumDivide = 111;
  995. Keys.A = 65;
  996. Keys.B = 66;
  997. Keys.C = 67;
  998. Keys.D = 68;
  999. Keys.E = 69;
  1000. Keys.F = 70;
  1001. Keys.G = 71;
  1002. Keys.H = 72;
  1003. Keys.I = 73;
  1004. Keys.J = 74;
  1005. Keys.K = 75;
  1006. Keys.L = 76;
  1007. Keys.M = 77;
  1008. Keys.N = 78;
  1009. Keys.O = 79;
  1010. Keys.P = 80;
  1011. Keys.Q = 81;
  1012. Keys.R = 82;
  1013. Keys.S = 83;
  1014. Keys.T = 84;
  1015. Keys.U = 85;
  1016. Keys.V = 86;
  1017. Keys.W = 87;
  1018. Keys.X = 88;
  1019. Keys.Y = 89;
  1020. Keys.Z = 90;
  1021. Keys.Key0 = 48;
  1022. Keys.Key1 = 49;
  1023. Keys.Key2 = 50;
  1024. Keys.Key3 = 51;
  1025. Keys.Key4 = 52;
  1026. Keys.Key5 = 53;
  1027. Keys.Key6 = 54;
  1028. Keys.Key7 = 55;
  1029. Keys.Key8 = 56;
  1030. Keys.Key9 = 57;
  1031. Sounds.prototype.registerSound = function(linkage, defaultVolume)
  1032. {
  1033.    if(defaultVolume == undefined)
  1034.    {
  1035.       defaultVolume = 100;
  1036.    }
  1037.    var _loc4_ = this.clip.getNextHighestDepth();
  1038.    var _loc2_ = this.clip.createEmptyMovieClip(linkage + "_" + _loc4_,_loc4_);
  1039.    _loc2_.sound = new Sound(_loc2_);
  1040.    _loc2_.sound.defaultVolume = defaultVolume;
  1041.    _loc2_.sound.clip = _loc2_;
  1042.    _loc2_.sound.attachSound(linkage);
  1043.    _loc2_.sound.setVolume(defaultVolume);
  1044.    this.sounds[linkage] = _loc2_.sound;
  1045.    this.sounds[linkage].looping = false;
  1046.    this.sounds[linkage].playing = false;
  1047.    this.sounds[linkage].onSoundComplete = function()
  1048.    {
  1049.       if(this.looping)
  1050.       {
  1051.          this.start();
  1052.       }
  1053.       else
  1054.       {
  1055.          this.playing = false;
  1056.       }
  1057.    };
  1058.    return _loc2_.sound;
  1059. };
  1060. Sounds.prototype.registerGroup = function(groupID, arrGroupIDs)
  1061. {
  1062.    var _loc2_ = 0;
  1063.    while(_loc2_ < arrGroupIDs.length)
  1064.    {
  1065.       if(this.sounds[arrGroupIDs[_loc2_]] == undefined)
  1066.       {
  1067.          trace("Sounds: Group \'" + groupID + "\' contains non-registered sound ID \'" + arrGroupIDs[_loc2_] + "\'");
  1068.       }
  1069.       _loc2_ = _loc2_ + 1;
  1070.    }
  1071.    this.groups[groupID] = arrGroupIDs;
  1072. };
  1073. Sounds.prototype.play = function(id, volume, loop, soundPosition)
  1074. {
  1075.    if(this.muted)
  1076.    {
  1077.       return undefined;
  1078.    }
  1079.    if(loop != undefined)
  1080.    {
  1081.       this.sounds[id].looping = loop;
  1082.    }
  1083.    if(soundPosition == undefined)
  1084.    {
  1085.       soundPosition = 0;
  1086.    }
  1087.    if(this.groups[id] != undefined)
  1088.    {
  1089.       id = this.groups[id][Maths.randomInt(0,this.groups[id].length - 1)];
  1090.    }
  1091.    if(this.sounds[id] == undefined)
  1092.    {
  1093.       trace("Sounds: Trying to play unregistered sound \'" + id + "\'");
  1094.    }
  1095.    if(volume != undefined)
  1096.    {
  1097.       this.sounds[id].setVolume(volume);
  1098.    }
  1099.    this.sounds[id].start(soundPosition);
  1100.    this.sounds[id].playing = true;
  1101. };
  1102. Sounds.prototype.stop = function(id)
  1103. {
  1104.    if(this.sounds[id] == undefined)
  1105.    {
  1106.       trace("Sounds: Trying to stop unregistered sound \'" + id + "\'");
  1107.    }
  1108.    this.sounds[id].looping = false;
  1109.    this.sounds[id].stop();
  1110.    this.sounds[id].playing = false;
  1111. };
  1112. Sounds.prototype.volume = function(id, volume)
  1113. {
  1114.    if(this.sounds[id] == undefined)
  1115.    {
  1116.       trace("Sounds: Trying to set volume of unregistered sound \'" + id + "\'");
  1117.    }
  1118.    this.sounds[id].setVolume(volume);
  1119. };
  1120. Sounds.prototype.fadeTo = function(id, volume, dVol)
  1121. {
  1122.    if(this.sounds[id] == undefined)
  1123.    {
  1124.       trace("Sounds: Trying to fade volume of unregistered sound \'" + id + "\'");
  1125.    }
  1126.    if(dVol == undefined)
  1127.    {
  1128.       dVol = 1;
  1129.    }
  1130.    this.sounds[id].dVol = Math.ceil(Math.abs(dVol));
  1131.    this.sounds[id].targetVol = volume;
  1132. };
  1133. Sounds.prototype.stopAllSounds = function()
  1134. {
  1135.    for(id in this.sounds)
  1136.    {
  1137.       this.stop(id);
  1138.    }
  1139. };
  1140. Sounds.prototype.fadeOutAllSounds = function(dVol)
  1141. {
  1142.    for(id in this.sounds)
  1143.    {
  1144.       this.fadeTo(id,0,dVol);
  1145.    }
  1146. };
  1147. Sounds.prototype.setMute = function(muted)
  1148. {
  1149.    this.muted = muted;
  1150.    if(this.muted)
  1151.    {
  1152.       this.stopAllSounds();
  1153.    }
  1154. };
  1155. Sounds.prototype.registerSources = function(listenerClip, arrSourceClips, id, maxAudibleRange)
  1156. {
  1157.    var _loc2_ = {};
  1158.    _loc2_.listener = listenerClip;
  1159.    _loc2_.sources = arrSourceClips;
  1160.    _loc2_.sound = this.sounds[id];
  1161.    _loc2_.maxRange = maxAudibleRange;
  1162.    this.play(id,0,true);
  1163.    this.loops.push(_loc2_);
  1164.    return _loc2_.sources;
  1165. };
  1166. Sounds.prototype.removeAllSources = function()
  1167. {
  1168.    var _loc2_ = 0;
  1169.    while(_loc2_ < this.loops.length)
  1170.    {
  1171.       var _loc3_ = this.loops[_loc2_];
  1172.       _loc3_.sound.stop();
  1173.       _loc2_ = _loc2_ + 1;
  1174.    }
  1175.    this.loops = [];
  1176. };
  1177. Sounds.prototype.evtEnterFrame = function()
  1178. {
  1179.    var _loc10_ = 0;
  1180.    while(_loc10_ < this.loops.length)
  1181.    {
  1182.       var _loc3_ = this.loops[_loc10_];
  1183.       var _loc7_ = _loc3_.maxRange;
  1184.       var _loc8_ = _loc3_.listener.holderToGlobal();
  1185.       var _loc2_ = 0;
  1186.       while(_loc2_ < _loc3_.sources.length)
  1187.       {
  1188.          var _loc4_ = _loc3_.sources[_loc2_];
  1189.          if(_loc4_ == undefined || _loc4_.notSoundSource == true)
  1190.          {
  1191.             _loc3_.sources.splice(_loc2_,1);
  1192.             _loc2_ = _loc2_ - 1;
  1193.          }
  1194.          else
  1195.          {
  1196.             var _loc5_ = _loc4_.holderToGlobal();
  1197.             var _loc6_ = Maths.distance(_loc8_.x,_loc8_.y,_loc5_.x,_loc5_.y);
  1198.             if(_loc6_ < _loc7_)
  1199.             {
  1200.                _loc7_ = _loc6_;
  1201.             }
  1202.          }
  1203.          _loc2_ = _loc2_ + 1;
  1204.       }
  1205.       _loc3_.sound.setVolume(Math.floor(100 * (_loc3_.maxRange - _loc7_) / _loc3_.maxRange));
  1206.       _loc10_ = _loc10_ + 1;
  1207.    }
  1208.    for(id in this.sounds)
  1209.    {
  1210.       if(this.sounds[id].targetVol != undefined)
  1211.       {
  1212.          var _loc9_ = this.sounds[id].getVolume();
  1213.          var _loc11_ = _loc9_ - this.sounds[id].targetVol;
  1214.          if(Math.abs(_loc11_) < this.sounds[id].dVol)
  1215.          {
  1216.             this.sounds[id].setVolume(this.sounds[id].targetVol);
  1217.             this.sounds[id].targetVol = undefined;
  1218.          }
  1219.          else
  1220.          {
  1221.             this.sounds[id].setVolume(_loc11_ <= 0 ? _loc9_ + this.sounds[id].dVol : _loc9_ - this.sounds[id].dVol);
  1222.          }
  1223.       }
  1224.    }
  1225. };
  1226. Physics.prototype.step = function()
  1227. {
  1228.    if(this.paused == true)
  1229.    {
  1230.       return undefined;
  1231.    }
  1232.    var _loc14_ = 0;
  1233.    while(_loc14_ < this.masses.length)
  1234.    {
  1235.       var _loc13_ = this.masses[_loc14_];
  1236.       _loc13_.hasHitSurface = false;
  1237.       if(!_loc13_.fixed)
  1238.       {
  1239.          _loc13_.prevX = _loc13_.x;
  1240.          _loc13_.prevY = _loc13_.y;
  1241.          var _loc6_ = _loc13_.sumSpringForces();
  1242.          _loc6_.x += this.gravityX * _loc13_.mass;
  1243.          _loc6_.y += this.gravityY * _loc13_.mass;
  1244.          _loc6_.x += _loc13_.extForceX;
  1245.          _loc6_.y += _loc13_.extForceY;
  1246.          _loc13_.extForceX = 0;
  1247.          _loc13_.extForceY = 0;
  1248.          _loc13_.vx += _loc6_.x / _loc13_.mass;
  1249.          _loc13_.vy += _loc6_.y / _loc13_.mass;
  1250.       }
  1251.       _loc14_ = _loc14_ + 1;
  1252.    }
  1253.    if(this.attractingMasses)
  1254.    {
  1255.       _loc14_ = 0;
  1256.       while(_loc14_ < this.masses.length)
  1257.       {
  1258.          _loc13_ = this.masses[_loc14_];
  1259.          if(_loc13_.attractionMass != 0)
  1260.          {
  1261.             _loc13_.applyAttractionForces();
  1262.          }
  1263.          _loc14_ = _loc14_ + 1;
  1264.       }
  1265.    }
  1266.    _loc14_ = 0;
  1267.    while(_loc14_ < this.masses.length)
  1268.    {
  1269.       _loc13_ = this.masses[_loc14_];
  1270.       if(!_loc13_.fixed)
  1271.       {
  1272.          if(_loc13_.vx > _loc13_.friction)
  1273.          {
  1274.             _loc13_.vx -= _loc13_.friction;
  1275.          }
  1276.          else if(_loc13_.vx < - _loc13_.friction)
  1277.          {
  1278.             _loc13_.vx += _loc13_.friction;
  1279.          }
  1280.          else
  1281.          {
  1282.             _loc13_.vx = 0;
  1283.          }
  1284.          if(_loc13_.vy > _loc13_.friction)
  1285.          {
  1286.             _loc13_.vy -= _loc13_.friction;
  1287.          }
  1288.          else if(_loc13_.vy < - _loc13_.friction)
  1289.          {
  1290.             _loc13_.vy += _loc13_.friction;
  1291.          }
  1292.          else
  1293.          {
  1294.             _loc13_.vy = 0;
  1295.          }
  1296.          _loc13_.vx *= this.drag;
  1297.          _loc13_.vy *= this.drag;
  1298.       }
  1299.       _loc14_ = _loc14_ + 1;
  1300.    }
  1301.    _loc14_ = 0;
  1302.    while(_loc14_ < this.masses.length)
  1303.    {
  1304.       _loc13_ = this.masses[_loc14_];
  1305.       _loc13_.x += _loc13_.vx;
  1306.       _loc13_.y += _loc13_.vy;
  1307.       _loc14_ = _loc14_ + 1;
  1308.    }
  1309.    this.masses.sort(massSort,Array.NUMERIC);
  1310.    _loc14_ = 0;
  1311.    while(_loc14_ < this.masses.length)
  1312.    {
  1313.       this.masses[_loc14_].testedSet = [];
  1314.       _loc14_ = _loc14_ + 1;
  1315.    }
  1316.    var _loc7_ = [];
  1317.    if(this.collidableMasses)
  1318.    {
  1319.       _loc14_ = 0;
  1320.       while(_loc14_ < this.masses.length)
  1321.       {
  1322.          var _loc9_ = this.masses[_loc14_];
  1323.          var _loc16_ = this.biggestMassRadius + _loc9_.radius + 1;
  1324.          var _loc15_ = _loc9_.x + _loc16_;
  1325.          var _loc2_ = _loc14_ + 1;
  1326.          while(_loc2_ < this.masses.length)
  1327.          {
  1328.             var _loc8_ = this.masses[_loc2_];
  1329.             if(_loc8_.x > _loc15_)
  1330.             {
  1331.                _loc2_ = this.masses.length;
  1332.             }
  1333.             else if(_loc9_ != undefined && _loc8_ != undefined && _loc9_.testedSet[_loc2_] == undefined && _loc9_.collisionSet != undefined && _loc8_.collisionSet != undefined && _loc9_.collisionSet != _loc8_.collisionSet)
  1334.             {
  1335.                var _loc5_ = _loc9_.x - _loc8_.x;
  1336.                var _loc4_ = _loc9_.y - _loc8_.y;
  1337.                var _loc12_ = _loc5_ * _loc5_ + _loc4_ * _loc4_;
  1338.                var _loc10_ = (_loc9_.radius + _loc8_.radius) * (_loc9_.radius + _loc8_.radius);
  1339.                if(_loc12_ < _loc10_)
  1340.                {
  1341.                   _loc7_.push({massA:_loc9_,massB:_loc8_});
  1342.                }
  1343.                _loc9_.testedSet[_loc2_] = true;
  1344.                _loc8_.testedSet[_loc14_] = true;
  1345.             }
  1346.             _loc2_ = _loc2_ + 1;
  1347.          }
  1348.          _loc15_ = _loc9_.x - _loc16_;
  1349.          _loc2_ = _loc14_ - 1;
  1350.          while(_loc2_ >= 0)
  1351.          {
  1352.             _loc8_ = this.masses[_loc2_];
  1353.             if(_loc8_.x < _loc15_)
  1354.             {
  1355.                _loc2_ = -1;
  1356.             }
  1357.             else if(_loc9_ != undefined && _loc8_ != undefined && _loc9_.testedSet[_loc2_] == undefined && _loc9_.collisionSet != undefined && _loc8_.collisionSet != undefined && _loc9_.collisionSet != _loc8_.collisionSet)
  1358.             {
  1359.                _loc5_ = _loc9_.x - _loc8_.x;
  1360.                _loc4_ = _loc9_.y - _loc8_.y;
  1361.                _loc12_ = _loc5_ * _loc5_ + _loc4_ * _loc4_;
  1362.                _loc10_ = _loc9_.radiusSquared + _loc8_.radiusSquared;
  1363.                if(_loc12_ < _loc10_)
  1364.                {
  1365.                   _loc7_.push({massA:_loc9_,massB:_loc8_});
  1366.                }
  1367.                _loc9_.testedSet[_loc2_] = true;
  1368.                _loc8_.testedSet[_loc14_] = true;
  1369.             }
  1370.             _loc2_ = _loc2_ - 1;
  1371.          }
  1372.          _loc14_ = _loc14_ + 1;
  1373.       }
  1374.    }
  1375.    _loc7_.sort(collisionSort);
  1376.    _loc14_ = 0;
  1377.    while(_loc14_ < _loc7_.length)
  1378.    {
  1379.       _loc7_[_loc14_].massA.resolveCollision(_loc7_[_loc14_].massB);
  1380.       _loc14_ = _loc14_ + 1;
  1381.    }
  1382.    _loc14_ = 0;
  1383.    while(_loc14_ < this.masses.length)
  1384.    {
  1385.       var _loc17_ = this.masses[_loc14_];
  1386.       _loc2_ = 0;
  1387.       while(_loc2_ < this.surfaces.length)
  1388.       {
  1389.          var _loc11_ = this.surfaces[_loc2_];
  1390.          _loc11_.handleCollision(_loc17_);
  1391.          _loc2_ = _loc2_ + 1;
  1392.       }
  1393.       _loc14_ = _loc14_ + 1;
  1394.    }
  1395.    if(this.framePaintCallback)
  1396.    {
  1397.       this.framePaintCallback();
  1398.    }
  1399.    if(this.defaultPaint)
  1400.    {
  1401.       _loc14_ = 0;
  1402.       while(_loc14_ < this.masses.length)
  1403.       {
  1404.          _loc13_ = this.masses[_loc14_];
  1405.          _loc13_.clip._x = _loc13_.x;
  1406.          _loc13_.clip._y = _loc13_.y;
  1407.          _loc14_ = _loc14_ + 1;
  1408.       }
  1409.       _loc14_ = 0;
  1410.       while(_loc14_ < this.springs.length)
  1411.       {
  1412.          var _loc3_ = this.springs[_loc14_];
  1413.          _loc3_.clip.clear();
  1414.          _loc3_.clip.lineStyle(1,16711680,100);
  1415.          _loc3_.clip.moveTo(_loc3_.mass1.x,_loc3_.mass1.y);
  1416.          _loc3_.clip.lineTo(_loc3_.mass2.x,_loc3_.mass2.y);
  1417.          _loc14_ = _loc14_ + 1;
  1418.       }
  1419.    }
  1420. };
  1421. Mass.prototype.setRadius = function(r)
  1422. {
  1423.    this.radius = r;
  1424.    this.radiusSquared = this.radius * this.radius;
  1425.    this.clip.clear();
  1426.    this.clip.lineStyle(this.radius * 2,255,50);
  1427.    this.clip.moveTo(0,0);
  1428.    this.clip.lineTo(0,1);
  1429. };
  1430. Mass.prototype.removeMass = function()
  1431. {
  1432.    var _loc2_ = 0;
  1433.    while(_loc2_ < this.springs.length)
  1434.    {
  1435.       this.springs[_loc2_].removeSpring();
  1436.       _loc2_ = _loc2_ - 1;
  1437.       _loc2_ = _loc2_ + 1;
  1438.    }
  1439.    _loc2_ = 0;
  1440.    while(_loc2_ < this.physics.masses.length)
  1441.    {
  1442.       if(this == this.physics.masses[_loc2_])
  1443.       {
  1444.          this.physics.masses.splice(_loc2_,1);
  1445.          _loc2_ = this.physics.masses.length;
  1446.       }
  1447.       _loc2_ = _loc2_ + 1;
  1448.    }
  1449.    if(this.physics.defaultPaint)
  1450.    {
  1451.       this.clip.removeMovieClip();
  1452.    }
  1453.    this.removed = true;
  1454. };
  1455. Mass.prototype.sumSpringForces = function()
  1456. {
  1457.    if(this.fixed)
  1458.    {
  1459.       return {x:0,y:0};
  1460.    }
  1461.    var _loc5_ = {x:0,y:0};
  1462.    var _loc3_ = 0;
  1463.    while(_loc3_ < this.springs.length)
  1464.    {
  1465.       var _loc2_ = undefined;
  1466.       var _loc4_ = this.springs[_loc3_];
  1467.       if(this == _loc4_.mass1)
  1468.       {
  1469.          _loc2_ = _loc4_.forceOnMass1();
  1470.       }
  1471.       else
  1472.       {
  1473.          _loc2_ = _loc4_.forceOnMass2();
  1474.       }
  1475.       _loc5_.x += _loc2_.x;
  1476.       _loc5_.y += _loc2_.y;
  1477.       _loc3_ = _loc3_ + 1;
  1478.    }
  1479.    return _loc5_;
  1480. };
  1481. Mass.prototype.applyAttractionForces = function()
  1482. {
  1483.    var _loc3_ = 0;
  1484.    while(_loc3_ < this.physics.masses.length)
  1485.    {
  1486.       var _loc2_ = this.physics.masses[_loc3_];
  1487.       if(_loc2_.attractionMass && this != _loc2_ && !_loc2_.fixed)
  1488.       {
  1489.          var _loc4_ = this.attractionForce(_loc2_);
  1490.          _loc2_.vx += _loc4_.x / _loc2_.mass;
  1491.          _loc2_.vy += _loc4_.y / _loc2_.mass;
  1492.       }
  1493.       _loc3_ = _loc3_ + 1;
  1494.    }
  1495. };
  1496. Mass.prototype.attractionForce = function(otherMass)
  1497. {
  1498.    var _loc5_ = this.x - otherMass.x;
  1499.    var _loc4_ = this.y - otherMass.y;
  1500.    var _loc3_ = Maths.vectorLength(_loc5_,_loc4_);
  1501.    _loc5_ /= _loc3_;
  1502.    _loc4_ /= _loc3_;
  1503.    var _loc2_ = this.attractionMass * this.physics.attractionScale / (_loc3_ * _loc3_);
  1504.    if(Math.abs(_loc2_) > this.attractionMaxForce)
  1505.    {
  1506.       _loc2_ = _loc2_ <= 0 ? - this.attractionMaxForce : this.attractionMaxForce;
  1507.    }
  1508.    return {x:_loc5_ * _loc2_,y:_loc4_ * _loc2_};
  1509. };
  1510. Mass.prototype.resolveCollision = function(otherMass)
  1511. {
  1512.    if(this.collisionSet == undefined || this.collisionSet == otherMass.collisionSet)
  1513.    {
  1514.       return undefined;
  1515.    }
  1516.    if(otherMass == undefined)
  1517.    {
  1518.       return undefined;
  1519.    }
  1520.    var _loc9_ = Maths.distance(this.x,this.y,otherMass.x,otherMass.y);
  1521.    var _loc3_ = this.radius + otherMass.radius;
  1522.    if(_loc9_ < _loc3_)
  1523.    {
  1524.       var _loc5_ = (this.x + otherMass.x) / 2;
  1525.       var _loc4_ = (this.y + otherMass.y) / 2;
  1526.       var _loc7_ = this.x - _loc5_;
  1527.       var _loc6_ = this.y - _loc4_;
  1528.       var _loc8_ = Maths.vectorLength(_loc7_,_loc6_);
  1529.       _loc7_ /= _loc8_;
  1530.       _loc6_ /= _loc8_;
  1531.       if(!this.fixed && !otherMass.fixed)
  1532.       {
  1533.          this.x = _loc5_ + _loc7_ * _loc3_ / 2;
  1534.          this.y = _loc4_ + _loc6_ * _loc3_ / 2;
  1535.          otherMass.x = _loc5_ + _loc7_ * (- _loc3_) / 2;
  1536.          otherMass.y = _loc4_ + _loc6_ * (- _loc3_) / 2;
  1537.       }
  1538.       else
  1539.       {
  1540.          if(this.fixed && otherMass.fixed)
  1541.          {
  1542.             return undefined;
  1543.          }
  1544.          if(!this.fixed)
  1545.          {
  1546.             this.x = _loc5_ + _loc7_ * _loc3_ / 2;
  1547.             this.y = _loc4_ + _loc6_ * _loc3_ / 2;
  1548.          }
  1549.          if(!otherMass.fixed)
  1550.          {
  1551.             otherMass.x = _loc5_ + _loc7_ * (- _loc3_) / 2;
  1552.             otherMass.y = _loc4_ + _loc6_ * (- _loc3_) / 2;
  1553.          }
  1554.       }
  1555.       this.collisionX = _loc5_;
  1556.       this.collisionY = _loc4_;
  1557.       otherMass.collisionX = _loc5_;
  1558.       otherMass.collisionY = _loc4_;
  1559.       this.respondToCollision(otherMass);
  1560.       this.collisionCallback(otherMass);
  1561.       otherMass.collisionCallback(this);
  1562.    }
  1563. };
  1564. Mass.prototype.respondToCollision = function(otherMass)
  1565. {
  1566.    var _loc7_ = Math.atan2(this.y - otherMass.y,this.x - otherMass.x);
  1567.    var _loc4_ = Math.cos(_loc7_);
  1568.    var _loc3_ = Math.sin(_loc7_);
  1569.    var _loc6_ = this.vx * _loc4_ + this.vy * _loc3_;
  1570.    var _loc9_ = this.vy * _loc4_ - this.vx * _loc3_;
  1571.    var _loc5_ = otherMass.vx * _loc4_ + otherMass.vy * _loc3_;
  1572.    var _loc8_ = otherMass.vy * _loc4_ - otherMass.vx * _loc3_;
  1573.    var _loc12_ = this.mass * _loc6_ + otherMass.mass * _loc5_;
  1574.    var _loc13_ = _loc6_ - _loc5_;
  1575.    var _loc10_ = (_loc12_ + this.mass * _loc13_) / (this.mass + otherMass.mass);
  1576.    var _loc11_ = _loc10_ - _loc6_ + _loc5_;
  1577.    _loc6_ = _loc11_;
  1578.    _loc5_ = _loc10_;
  1579.    if(!this.fixed)
  1580.    {
  1581.       this.vx = _loc6_ * _loc4_ - _loc9_ * _loc3_;
  1582.       this.vy = _loc9_ * _loc4_ + _loc6_ * _loc3_;
  1583.    }
  1584.    if(!otherMass.fixed)
  1585.    {
  1586.       otherMass.vx = _loc5_ * _loc4_ - _loc8_ * _loc3_;
  1587.       otherMass.vy = _loc8_ * _loc4_ + _loc5_ * _loc3_;
  1588.    }
  1589. };
  1590. Spring.prototype.removeSpring = function()
  1591. {
  1592.    this.clip.removeMovieClip();
  1593.    var _loc2_ = 0;
  1594.    while(_loc2_ < this.mass1.springs.length)
  1595.    {
  1596.       if(this == this.mass1.springs[_loc2_])
  1597.       {
  1598.          this.mass1.springs.splice(_loc2_,1);
  1599.          break;
  1600.       }
  1601.       _loc2_ = _loc2_ + 1;
  1602.    }
  1603.    _loc2_ = 0;
  1604.    while(_loc2_ < this.mass2.springs.length)
  1605.    {
  1606.       if(this == this.mass2.springs[_loc2_])
  1607.       {
  1608.          this.mass2.springs.splice(_loc2_,1);
  1609.          break;
  1610.       }
  1611.       _loc2_ = _loc2_ + 1;
  1612.    }
  1613.    _loc2_ = 0;
  1614.    while(_loc2_ < this.physics.springs.length)
  1615.    {
  1616.       if(this == this.physics.springs[_loc2_])
  1617.       {
  1618.          this.physics.springs.splice(_loc2_,1);
  1619.          return undefined;
  1620.       }
  1621.       _loc2_ = _loc2_ + 1;
  1622.    }
  1623. };
  1624. Spring.prototype.currentLength = function()
  1625. {
  1626.    var _loc5_ = this.mass1.x;
  1627.    var _loc3_ = this.mass1.y;
  1628.    var _loc4_ = this.mass2.x;
  1629.    var _loc2_ = this.mass2.y;
  1630.    return Maths.distance(_loc5_,_loc3_,_loc4_,_loc2_);
  1631. };
  1632. Spring.prototype.currentExtension = function()
  1633. {
  1634.    return this.currentLength() - this.naturalLength;
  1635. };
  1636. Spring.prototype.forceOnMass1 = function()
  1637. {
  1638.    var _loc9_ = this.mass1.x;
  1639.    var _loc7_ = this.mass1.y;
  1640.    var _loc8_ = this.mass2.x;
  1641.    var _loc6_ = this.mass2.y;
  1642.    var _loc4_ = _loc8_ - _loc9_;
  1643.    var _loc3_ = _loc6_ - _loc7_;
  1644.    var _loc2_ = Maths.vectorLength(_loc4_,_loc3_);
  1645.    var _loc11_ = _loc4_ / _loc2_;
  1646.    var _loc10_ = _loc3_ / _loc2_;
  1647.    var _loc12_ = this.currentExtension() * this.k;
  1648.    var _loc14_ = this.mass2.vx - this.mass1.vx;
  1649.    var _loc13_ = this.mass2.vy - this.mass1.vy;
  1650.    var _loc15_ = this.damperK * Maths.dotProduct(_loc14_,_loc13_,_loc4_,_loc3_) / _loc2_;
  1651.    var _loc5_ = _loc15_ + _loc12_;
  1652.    return {x:_loc11_ * _loc5_,y:_loc10_ * _loc5_};
  1653. };
  1654. Spring.prototype.forceOnMass2 = function()
  1655. {
  1656.    var _loc2_ = this.forceOnMass1();
  1657.    return {x:- _loc2_.x,y:- _loc2_.y};
  1658. };
  1659. Surface.prototype.update = function()
  1660. {
  1661.    this.len = this.currentLength();
  1662.    this.x = this.x1;
  1663.    this.y = this.y1;
  1664.    this.dx = this.x2 - this.x1;
  1665.    this.dy = this.y2 - this.y1;
  1666.    this.nx = this.dx / this.len;
  1667.    this.ny = this.dy / this.len;
  1668.    this.normX = - this.ny;
  1669.    this.normY = this.nx;
  1670.    this.paint();
  1671. };
  1672. Surface.prototype.paint = function()
  1673. {
  1674.    this.clip.clear();
  1675.    this.clip.lineStyle(1,65535,100);
  1676.    this.clip.moveTo(this.x1,this.y1);
  1677.    this.clip.lineTo(this.x2,this.y2);
  1678. };
  1679. Surface.prototype.currentLength = function()
  1680. {
  1681.    return Maths.vectorLength(this.x1,this.y1,this.x2,this.y2);
  1682. };
  1683. Surface.prototype.removeSurface = function()
  1684. {
  1685.    this.clip.removeMovieClip();
  1686.    var _loc2_ = 0;
  1687.    while(_loc2_ < this.physics.surfaces.length)
  1688.    {
  1689.       if(this == this.physics.surfaces[_loc2_])
  1690.       {
  1691.          this.physics.surfaces.splice(_loc2_,1);
  1692.          return undefined;
  1693.       }
  1694.       _loc2_ = _loc2_ + 1;
  1695.    }
  1696. };
  1697. Surface.prototype.handleCollision = function(objMass)
  1698. {
  1699.    var _loc4_ = {};
  1700.    _loc4_.dx = objMass.x - this.x1;
  1701.    _loc4_.dy = objMass.y - this.y1;
  1702.    var _loc13_ = Maths.dotProduct(_loc4_.dx,_loc4_.dy,this.dx,this.dy);
  1703.    var _loc2_ = {x:this.x1,y:this.y1,dx:_loc4_.dx,dy:_loc4_.dy};
  1704.    if(_loc13_ >= 0)
  1705.    {
  1706.       var _loc5_ = {};
  1707.       _loc5_.dx = objMass.x - this.x2;
  1708.       _loc5_.dy = objMass.y - this.y2;
  1709.       _loc13_ = Maths.dotProduct(_loc5_.dx,_loc5_.dy,this.dx,this.dy);
  1710.       _loc2_ = {x:this.x2,y:this.y2,dx:_loc5_.dx,dy:_loc5_.dy};
  1711.       if(_loc13_ <= 0)
  1712.       {
  1713.          var _loc11_ = {dx:this.normX,dy:this.normY};
  1714.          _loc2_ = Maths.vectorProject(_loc4_,_loc11_);
  1715.          _loc2_.x = objMass.x - _loc2_.dx;
  1716.          _loc2_.y = objMass.y - _loc2_.dy;
  1717.       }
  1718.    }
  1719.    var _loc8_ = Maths.vectorLength(_loc2_.dx,_loc2_.dy);
  1720.    var _loc7_ = objMass.radius - _loc8_;
  1721.    if(_loc7_ >= 0)
  1722.    {
  1723.       objMass.hasHitSurface = true;
  1724.       _loc2_.nx = _loc2_.dx / _loc8_;
  1725.       _loc2_.ny = _loc2_.dy / _loc8_;
  1726.       objMass.x += _loc7_ * _loc2_.nx;
  1727.       objMass.y += _loc7_ * _loc2_.ny;
  1728.       var _loc12_ = {dx:_loc2_.dy,dy:- _loc2_.dx};
  1729.       var _loc10_ = {dx:objMass.vx,dy:objMass.vy};
  1730.       var _loc6_ = Maths.vectorProject(_loc10_,_loc2_);
  1731.       var _loc9_ = Maths.vectorProject(_loc10_,_loc12_);
  1732.       objMass.collisionNormal = {x:_loc6_.dx,y:_loc6_.dy};
  1733.       objMass.vx = (- this.restitution) * _loc6_.dx + this.friction * _loc9_.dx;
  1734.       objMass.vy = (- this.restitution) * _loc6_.dy + this.friction * _loc9_.dy;
  1735.    }
  1736.    return false;
  1737. };
  1738. SpringBox.prototype.getPosition = function()
  1739. {
  1740.    pos = {x:0,y:0,rRad:0,rDeg:0};
  1741.    pos.x = (this.m_tl.x + this.m_tr.x + this.m_bl.x + this.m_br.x) / 4;
  1742.    pos.y = (this.m_tl.y + this.m_tr.y + this.m_bl.y + this.m_br.y) / 4;
  1743.    var _loc3_ = (this.frontLeft.x + this.frontRight.x) / 2;
  1744.    var _loc2_ = (this.frontLeft.y + this.frontRight.y) / 2;
  1745.    var _loc5_ = _loc3_ - pos.x;
  1746.    var _loc4_ = _loc2_ - pos.y;
  1747.    pos.rRad = Math.atan2(_loc4_,_loc5_);
  1748.    pos.rDeg = Maths.radToDeg(pos.rRad);
  1749.    return pos;
  1750. };
  1751. SpringLine.prototype.getPosition = function()
  1752. {
  1753.    pos = {x:0,y:0,rRad:0,rDeg:0};
  1754.    pos.x = (this.m_b.x + this.m_f.x) / 2;
  1755.    pos.y = (this.m_b.y + this.m_f.y) / 2;
  1756.    var _loc3_ = this.m_f.x;
  1757.    var _loc2_ = this.m_f.y;
  1758.    var _loc5_ = _loc3_ - pos.x;
  1759.    var _loc4_ = _loc2_ - pos.y;
  1760.    pos.rRad = Math.atan2(_loc4_,_loc5_);
  1761.    pos.rDeg = Maths.radToDeg(pos.rRad);
  1762.    return pos;
  1763. };
  1764. var arrNeverPress = ["Never press","Never press again","What? You were told not to press that","Seriously, stop pressing this button","Do you ever do what you\'re told?","Are you even reading these?","Are you even reading these?","Are you even reading these?","Oooh, persistent. STOP PRESSING!","That\'s it, one more press. The button dares you","Yup, the game just got made harder for you","Yep, really. You brought it on yourself","You only have yourself to blame","Seriously! It\'s like 4x harder now","Ok, so nothing\'s really changed","Except you\'re still clicking this button","You\'re not meant to be clicking this button","You know that, right?","You remember how this started?","You were told to never press","And yet you\'re still pressing","Endlessly pressing","You have no idea why you\'re still pressing","No clue at all, right?","Ok, time to stop pressing now","Really! Stop pressing","Stopit stopit stopit","STOPIT STOPIT STOPIT","AAAAGH! Stop pressing now!","Pleease stop pressing.","Right, no more begging.","Threats.","Nasty threats.","Keep pressing and I wipe your game progress","I mean it. Five more and bye-bye progress!","Four more...","Three...","Two","One more click and you lose your progress","Ha! It\'s gone. GONE! Gone for good","And your new progress won\'t be saved either","I\'ve deleted that part of the program","And yet you\'re still clicking","Endlessly clicking","Click click click click click...","New rules for clicking","From now on, each click earns you...","One file deleted at random from your hard drive!","Pop! There goes a file","Ping! And another","Was C:\\Windows\\win.ini important to you?","Another file deleted","Who needs all these files anyway?","You have thousands of \'em hanging around!","It\'s about time you had a clear up anyway","I\'m just helping you on your way","If I don\'t do it, someone else will","Maybe I\'m randomly deleting just the viruses","Or maybe your system files","I can\'t tell","But you\'re clicking lots and lots","Which means lots and lots of lost files","This is a clear case of escalation","You start annoying someone","Then keep pressing the buttons","Sooner or later they\'re getting revenge","By deleting all your files","You seem strangely unattached to your files","You do know what a file is, right?","They\'re the things on your computer","They make it function","They\'re your documents","They\'re your games","Your pictures","Everything on your computer lives in a file","And I\'m deleting one every time you click","...","...","...","Ok, so actually this is just a bit of a laugh","Nothing\'s really been changed by your clicking","No deleted files","Your game progress hasn\'t been wiped","The difficulty hasn\'t been cranked up","But it really is time to stop clicking","You see, it\'s inevitable","This button doesn\'t wear out","It can be clicked forever","But you. You!","You will get tired","You will need sleep","The button shall prevail","Long-live the button!","Short-live the human","Those fingers look soft","Like they\'d wear down over a few millenia","And you\'ve got to eat, right?","Have you set up a robot to press the button?","That\'d be cheating","The button would hate you for that","The button would be mad at you","And the button would cry","Do you want to make the button cry?","Do you?","DO YOU?","You\'re so mean.","*sniff*"];
  1765. ChoppaGame.prototype.initialise = function()
  1766. {
  1767.    _root.trackPoint("Level_" + _root.curLevelID + "_start");
  1768.    this.clip.level.gotoAndStop(_root.curLevelID);
  1769.    this.frame = 0;
  1770.    this.w = 730;
  1771.    this.h = 540;
  1772.    this.standardIdle = 0.3;
  1773.    this.standardThrottle = 1.2;
  1774.    this.winchIdle = 0.3;
  1775.    this.winchThrottle = 1.2;
  1776.    this.usedWinch = false;
  1777.    this.state = "flight";
  1778.    this.winchState = "idle";
  1779.    this.idleLift = this.standardIdle;
  1780.    this.throttleLift = this.standardThrottle;
  1781.    this.throttleLiftLow = this.standardThrottle * 0.6;
  1782.    this.torque = 0.04;
  1783.    this.perfect = true;
  1784.    this.bladeFrames = 10;
  1785.    this.controls = _root.controls;
  1786.    this.torqueAdjust = 1;
  1787.    switch(_root.sensitivity)
  1788.    {
  1789.       case "feather":
  1790.          this.torqueAdjust = 1;
  1791.          break;
  1792.       case "normal":
  1793.          this.torqueAdjust = 0.7;
  1794.          break;
  1795.       case "heavy":
  1796.          this.torqueAdjust = 0.4;
  1797.    }
  1798.    this.prevMouseX = _root._xmouse;
  1799.    this.prevMouseY = _root._ymouse;
  1800.    var _loc25_ = false;
  1801.    var _loc26_ = this.paint;
  1802.    this.gravity = 0.2;
  1803.    this.objPhysics = new Physics(this.clip.level.physics,0,this.gravity,0.99,true,false,_loc26_,_loc25_);
  1804.    addSurfaces(this.clip.level,"s",this.objPhysics,0.7,0.9);
  1805.    var _loc17_ = 0;
  1806.    var clip = this.clip.level["b" + _loc17_];
  1807.    while(clip != undefined)
  1808.    {
  1809.       if(clip.oneton)
  1810.       {
  1811.          clip.item = "oneton";
  1812.          var _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  1813.          var _loc5_ = new SpringBox(_loc9_.x,_loc9_.y,40,40,0,0,20,0.7,1.2,_loc17_,this.objPhysics);
  1814.          clip.objBox = _loc5_;
  1815.          _loc5_.m_tl.oneton = true;
  1816.          _loc5_.m_tr.oneton = true;
  1817.          _loc5_.m_bl.oneton = true;
  1818.          _loc5_.m_br.oneton = true;
  1819.          _loc5_.m_tl.collisionSound = "clunk";
  1820.          _loc5_.m_tr.collisionSound = "clunk";
  1821.          _loc5_.m_bl.collisionSound = "clunk";
  1822.          _loc5_.m_br.collisionSound = "clunk";
  1823.       }
  1824.       if(clip.magnet)
  1825.       {
  1826.          clip.item = "magnet";
  1827.          _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  1828.          var _loc3_ = new SpringLine(_loc9_.x,_loc9_.y,30,0,0,0,18,0.8,1,this.objPhysics,_loc17_);
  1829.          clip.objLine = _loc3_;
  1830.          this.objPhysics.attractingMasses = true;
  1831.          _loc3_.m_f.attractionMass = 25;
  1832.          _loc3_.m_f.collisionSound = "clink3";
  1833.          _loc3_.m_b.collisionSound = "clink3";
  1834.       }
  1835.       if(clip.scissors)
  1836.       {
  1837.          clip.item = "scissors";
  1838.          var _loc19_ = clip.f.holderToLocal(this.objPhysics.baseClip);
  1839.          var _loc16_ = clip.b.holderToLocal(this.objPhysics.baseClip);
  1840.          clip.m_f = new Mass(_loc19_.x,_loc16_.y,21,false,this.objPhysics,_loc17_);
  1841.          clip.m_b = new Mass(_loc16_.x,_loc16_.y,34,false,this.objPhysics,_loc17_);
  1842.          clip.objLine = makeSpringLine(clip.m_f,clip.m_b);
  1843.          clip.m_f.isScissorHandle = true;
  1844.          clip.m_b.isScissorBlade = true;
  1845.       }
  1846.       if(clip.hair)
  1847.       {
  1848.          clip.item = "hair";
  1849.          clip.cut = 0;
  1850.          this.clip.level.flag._y += 250;
  1851.       }
  1852.       if(clip.ball)
  1853.       {
  1854.          clip.item = "ball";
  1855.          _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  1856.          var _loc7_ = new Mass(_loc9_.x,_loc9_.y,19,false,this.objPhysics,_loc17_);
  1857.          _loc7_.mass = 1.5;
  1858.          _loc7_.clip = clip;
  1859.          clip.objMass = _loc7_;
  1860.          _loc7_.collisionSound = "clink";
  1861.       }
  1862.       if(clip.sailor)
  1863.       {
  1864.          clip.item = "sailor";
  1865.          _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  1866.          _loc7_ = new Mass(_loc9_.x,_loc9_.y,31,false,this.objPhysics,_loc17_);
  1867.          _loc7_.mass = 1.2;
  1868.          _loc7_.isSailor = true;
  1869.          _loc7_.clip = clip;
  1870.          clip.objMass = _loc7_;
  1871.       }
  1872.       if(clip.hitchecker)
  1873.       {
  1874.          clip.item = "hitchecker";
  1875.       }
  1876.       if(clip.boat)
  1877.       {
  1878.          clip.item = "boat";
  1879.          this.clip.level.flag._y += 1000;
  1880.          clip.p0._visible = false;
  1881.          clip.p1._visible = false;
  1882.          clip.p2._visible = false;
  1883.          clip.p3._visible = false;
  1884.          clip.p4._visible = false;
  1885.          clip.p5._visible = false;
  1886.          clip.p6._visible = false;
  1887.          var _loc8_ = clip.p0.holderToLocal(this.objPhysics.baseClip);
  1888.          _loc19_ = clip.p1.holderToLocal(this.objPhysics.baseClip);
  1889.          _loc16_ = clip.p2.holderToLocal(this.objPhysics.baseClip);
  1890.          var _loc15_ = clip.p3.holderToLocal(this.objPhysics.baseClip);
  1891.          var _loc14_ = clip.p4.holderToLocal(this.objPhysics.baseClip);
  1892.          var _loc13_ = clip.p5.holderToLocal(this.objPhysics.baseClip);
  1893.          var _loc12_ = clip.p6.holderToLocal(this.objPhysics.baseClip);
  1894.          clip.m0 = new Mass(_loc8_.x,_loc8_.y,25,false,this.objPhysics,_loc17_);
  1895.          clip.m1 = new Mass(_loc19_.x,_loc19_.y,25,false,this.objPhysics,_loc17_);
  1896.          clip.m2 = new Mass(_loc16_.x,_loc16_.y,25,false,this.objPhysics,_loc17_);
  1897.          clip.m3 = new Mass(_loc15_.x,_loc15_.y,25,false,this.objPhysics,_loc17_);
  1898.          clip.m4 = new Mass(_loc14_.x,_loc14_.y,25,false,this.objPhysics,_loc17_);
  1899.          clip.m5 = new Mass(_loc13_.x,_loc13_.y,25,false,this.objPhysics,_loc17_);
  1900.          clip.m6 = new Mass(_loc12_.x,_loc12_.y,25,false,this.objPhysics,_loc17_);
  1901.          clip.m0.mass = 1.2;
  1902.          clip.m1.mass = 1.2;
  1903.          clip.m2.mass = 1.2;
  1904.          clip.m3.mass = 1.2;
  1905.          clip.m4.mass = 1.2;
  1906.          clip.m5.mass = 1.2;
  1907.          clip.m6.mass = 1.2;
  1908.          clip.m0.isBoatFront = true;
  1909.          clip.m3.isBoatRear = true;
  1910.          clip.plaque = makeSpringLine(clip.m0,clip.m1);
  1911.          var _loc21_ = new Spring(clip.m1,clip.m2);
  1912.          _loc21_ = new Spring(clip.m2,clip.m3);
  1913.          _loc21_ = new Spring(clip.m3,clip.m4);
  1914.          _loc21_ = new Spring(clip.m4,clip.m5);
  1915.          _loc21_ = new Spring(clip.m5,clip.m6);
  1916.          _loc21_ = new Spring(clip.m6,clip.m0);
  1917.          _loc21_ = new Spring(clip.m6,clip.m1,0.1,0.3);
  1918.          _loc21_ = new Spring(clip.m1,clip.m5,0.1,0.3);
  1919.          _loc21_ = new Spring(clip.m5,clip.m2,0.1,0.3);
  1920.          _loc21_ = new Spring(clip.m2,clip.m4,0.1,0.3);
  1921.       }
  1922.       if(clip.sheep)
  1923.       {
  1924.          clip.item = "sheep";
  1925.          _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  1926.          _loc7_ = new Mass(_loc9_.x,_loc9_.y,25,false,this.objPhysics,_loc17_);
  1927.          _loc7_.mass = 1;
  1928.          _loc7_.isSheep = true;
  1929.          clip.objMass = _loc7_;
  1930.          clip.dir = Maths.randomNum(-0.3,0.3);
  1931.          clip.dirFrames = Maths.randomInt(30,100);
  1932.          _loc7_.collisionSound = "baa";
  1933.       }
  1934.       if(clip.sheeppen)
  1935.       {
  1936.          clip.item = "sheeppen";
  1937.       }
  1938.       if(clip.platform)
  1939.       {
  1940.          clip.item = "platform";
  1941.       }
  1942.       if(clip.hover)
  1943.       {
  1944.          clip.item = "hover";
  1945.       }
  1946.       if(clip.net)
  1947.       {
  1948.          clip.item = "net";
  1949.          clip.state = "untriggered";
  1950.          clip.masses = [];
  1951.          _loc8_ = clip.p0.holderToLocal(this.objPhysics.baseClip);
  1952.          _loc19_ = clip.p1.holderToLocal(this.objPhysics.baseClip);
  1953.          var _loc20_ = _loc19_.x - _loc8_.x;
  1954.          var _loc18_ = Math.floor(_loc20_ / 40);
  1955.          var _loc4_ = 0;
  1956.          while(_loc4_ < _loc18_)
  1957.          {
  1958.             var _loc6_ = new Mass(_loc8_.x + 40 * _loc4_,_loc8_.y,12,true,this.objPhysics,_loc4_ + 20);
  1959.             if(_loc4_ > 0)
  1960.             {
  1961.                _loc6_.netSpring = new Spring(_loc6_,clip.masses[_loc4_ - 1]);
  1962.             }
  1963.             clip.masses.push(_loc6_);
  1964.             _loc4_ = _loc4_ + 1;
  1965.          }
  1966.       }
  1967.       if(clip.bee)
  1968.       {
  1969.          clip.item = "bee";
  1970.          if(this.arrBees == undefined)
  1971.          {
  1972.             this.arrBees = _root.objSounds.registerSources(this.clip.level.choppa,[],"bee-buzz",300);
  1973.          }
  1974.          this.arrBees.push(clip);
  1975.          this.deadBees = 0;
  1976.          _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  1977.          clip.targetX = _loc9_.x;
  1978.          clip.targetY = _loc9_.y;
  1979.          clip.targetR = Maths.randomNum(0,6.283185307179586);
  1980.          clip.targetDR = Maths.randomNum(-0.05,-0.2);
  1981.          clip.targetRadius = Maths.randomNum(20,50);
  1982.          _loc7_ = new Mass(_loc9_.x,_loc9_.y,22,false,this.objPhysics,_loc17_);
  1983.          _loc7_.mass = 0.75;
  1984.          _loc7_.clip = clip;
  1985.          _loc7_.objGame = this;
  1986.          clip.objMass = _loc7_;
  1987.          _loc7_.collisionCallback = function(otherMass)
  1988.          {
  1989.             if(otherMass.oneton)
  1990.             {
  1991.                this.objGame.deadBees = this.objGame.deadBees + 1;
  1992.                if(this.objGame.deadBees == 6)
  1993.                {
  1994.                   _root.achieved(2);
  1995.                }
  1996.                _root.objSounds.play("bee-squish");
  1997.                this.clip.gotoAndPlay("death");
  1998.                this.clip.notSoundSource = true;
  1999.                this.removeMass();
  2000.             }
  2001.          };
  2002.       }
  2003.       if(clip.gootower)
  2004.       {
  2005.          clip.item = "gootower";
  2006.          this.makeGooTower(clip,5,100,0.1,0.2);
  2007.       }
  2008.       if(clip.stronggootower)
  2009.       {
  2010.          clip.item = "gootower";
  2011.          this.makeGooTower(clip,7,78,0.5,0.5);
  2012.       }
  2013.       if(clip.sam)
  2014.       {
  2015.          this.hitBySam = false;
  2016.          clip.item = "sam";
  2017.          clip.hit._visible = false;
  2018.          clip.rocketAway = false;
  2019.          clip.rocketID = _loc17_ + 1;
  2020.       }
  2021.       if(clip.rocket)
  2022.       {
  2023.          clip.item = "rocket";
  2024.          clip._visible = false;
  2025.          clip.active = false;
  2026.          clip.samID = _loc17_ - 1;
  2027.          clip.samClip = this.clip.level["b" + clip.samID];
  2028.          _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  2029.          _loc3_ = new SpringLine(_loc9_.x,_loc9_.y,68,0,0,0,18,0.8,1,this.objPhysics,_loc17_);
  2030.          _loc3_.m_f.idleX = _loc3_.m_f.x;
  2031.          _loc3_.m_f.idleY = _loc3_.m_f.y;
  2032.          _loc3_.m_b.idleX = _loc3_.m_b.x;
  2033.          _loc3_.m_b.idleY = _loc3_.m_b.y;
  2034.          _loc3_.m_f.objGame = this;
  2035.          _loc3_.m_f.rocketClip = clip;
  2036.          _loc3_.m_f.isRocket = true;
  2037.          _loc3_.m_b.isRocket = true;
  2038.          _loc3_.m_f.isNotWinchable = true;
  2039.          _loc3_.m_b.isNotWinchable = true;
  2040.          clip.objLine = _loc3_;
  2041.          _loc3_.m_f.collisionSound = "clink1";
  2042.          _loc3_.m_b.collisionSound = "clink1";
  2043.          _loc3_.m_f.collisionCallback = function(otherMass)
  2044.          {
  2045.             if(otherMass.isChoppa)
  2046.             {
  2047.                _root.objSounds.play("sam-hit");
  2048.                this.rocketClip.active = false;
  2049.                this.rocketClip._visible = false;
  2050.                this.rocketClip.samClip.rocketAway = false;
  2051.                this.objGame.createExplosion(this.x,this.y,20,500);
  2052.                this.objGame.hitBySam = true;
  2053.             }
  2054.          };
  2055.       }
  2056.       if(clip.gravitywell)
  2057.       {
  2058.          clip.item = "gravitywell";
  2059.          this.objPhysics.gravityX = 0;
  2060.          this.objPhysics.gravityY = 0;
  2061.          this.gravityCentreX = clip._x;
  2062.          this.gravityCentreY = clip._y;
  2063.          _loc4_ = 0;
  2064.          while(_loc4_ < 10)
  2065.          {
  2066.             clip["g" + _loc4_].gotoAndPlay(Maths.randomInt(1,clip["g" + _loc4_]._totalframes));
  2067.             _loc4_ = _loc4_ + 1;
  2068.          }
  2069.       }
  2070.       if(clip.fan)
  2071.       {
  2072.          clip.item = "fan";
  2073.          clip.hit._visible = false;
  2074.          if(this.arrFans == undefined)
  2075.          {
  2076.             this.arrFans = _root.objSounds.registerSources(this.clip.level.choppa,[],"wind-loop",270);
  2077.          }
  2078.          this.arrFans.push(clip.n0);
  2079.          this.arrFans.push(clip.n1);
  2080.          this.arrFans.push(clip.n2);
  2081.       }
  2082.       if(clip.mixer)
  2083.       {
  2084.          clip.item = "mixer";
  2085.          clip.dr = 0.1;
  2086.          clip.surfaces = addSurfaces(clip,"s",this.objPhysics,0.9,0.95);
  2087.       }
  2088.       if(clip.crushotron)
  2089.       {
  2090.          clip.item = "crushotron";
  2091.          clip.lSurfaces = addSurfaces(clip.l,"s",this.objPhysics,0.9,0.95);
  2092.          clip.rSurfaces = addSurfaces(clip.r,"s",this.objPhysics,0.9,0.95);
  2093.       }
  2094.       if(clip.button)
  2095.       {
  2096.          clip.item = "button";
  2097.          clip.state = "off";
  2098.          clip.hit._visible = false;
  2099.       }
  2100.       if(clip.lift)
  2101.       {
  2102.          clip.item = "lift";
  2103.          clip.surfaces = addSurfaces(clip.lift,"s",this.objPhysics,0.9,0.95);
  2104.          _root.objSounds.registerSources(this.clip.level.choppa,[clip.lift],"ratchet-loop",700);
  2105.       }
  2106.       if(clip.handle)
  2107.       {
  2108.          clip.item = "handle";
  2109.          _loc9_ = clip.holderToLocal(this.objPhysics.baseClip);
  2110.          var _loc11_ = clip.arm.handle.holderToLocal(this.objPhysics.baseClip);
  2111.          clip.prevAngle = clip.arm._rotation;
  2112.          clip.mHub = new Mass(_loc9_.x,_loc9_.y,10,true,this.objPhysics,_loc17_);
  2113.          clip.mHandle = new Mass(_loc11_.x,_loc11_.y,15,false,this.objPhysics,_loc17_);
  2114.          clip.sArm = new Spring(clip.mHub,clip.mHandle);
  2115.          clip.mHub.isNotWinchable = true;
  2116.          _root.objSounds.play("ratchet-loop",0,true);
  2117.          this.handleClip = clip;
  2118.       }
  2119.       if(clip.oven)
  2120.       {
  2121.          clip.item = "oven";
  2122.          this.handleClip._y += 340;
  2123.          this.handleClip.mHub.y += 340;
  2124.          this.handleClip.mHandle.y += 340;
  2125.          this.handleClip._visible = false;
  2126.          this.clip.level.flag._y += 100;
  2127.       }
  2128.       if(clip.wave)
  2129.       {
  2130.          clip.item = "wave";
  2131.          clip.gotoAndPlay(Maths.randomInt(1,clip._totalframes));
  2132.       }
  2133.       _loc17_ = _loc17_ + 1;
  2134.       clip = this.clip.level["b" + _loc17_];
  2135.    }
  2136.    var _loc24_ = this.clip.level.choppa.rotor.holderToLocal(this.clip);
  2137.    var _loc23_ = this.clip.level.choppa.tail.holderToLocal(this.clip);
  2138.    var _loc22_ = this.clip.level.choppa.cockpit.holderToLocal(this.clip);
  2139.    this.mRotor = new Mass(_loc24_.x,_loc24_.y,16,false,this.objPhysics,-1);
  2140.    this.mTail = new Mass(_loc23_.x,_loc23_.y,13,false,this.objPhysics,-1);
  2141.    this.mCockpit = new Mass(_loc22_.x,_loc22_.y,30,false,this.objPhysics,-1);
  2142.    this.mRotor.isChoppa = true;
  2143.    this.mTail.isChoppa = true;
  2144.    this.mCockpit.isChoppa = true;
  2145.    this.slChassis = makeSpringLine(this.mTail,this.mCockpit);
  2146.    this.slFront = makeSpringLine(this.mRotor,this.mCockpit);
  2147.    this.slBack = makeSpringLine(this.mRotor,this.mTail);
  2148.    _loc9_ = this.slFront.getPosition();
  2149.    this.choppaRotationOffset = this.clip.level.choppa._rotation - _loc9_.rDeg;
  2150.    this.choppaBrokenFrames = 0;
  2151.    this.clip.gameHitZone._visible = false;
  2152.    this.clip.screenCentre._visible = false;
  2153.    this.clip.pausePanel._visible = false;
  2154.    this.clip.winPanel._visible = false;
  2155.    this.clip.crashPanel._visible = false;
  2156.    this.clip.perfectPanel._visible = false;
  2157.    this.clip.fastPanel._visible = false;
  2158.    this.clip.winPanel._alpha = 0;
  2159.    this.clip.crashPanel._alpha = 0;
  2160.    this.clip.perfectPanel._alpha = 0;
  2161.    this.clip.fastPanel._alpha = 0;
  2162.    if(!_root.arrLevels[_root.curLevelID].passed)
  2163.    {
  2164.       this.clip.perfectIndicator._alpha = 0;
  2165.       this.clip.fastIndicator._alpha = 0;
  2166.    }
  2167.    this.stars = [];
  2168.    _loc17_ = 0;
  2169.    while(_loc17_ < 15)
  2170.    {
  2171.       var _loc10_ = this.clip.level.bg.getNextHighestDepth();
  2172.       this.clip.level.bg.attachMovie("star","star" + _loc10_,_loc10_);
  2173.       var clip = this.clip.level.bg["star" + _loc10_];
  2174.       _loc9_ = {x:Maths.randomInt(0,this.w),y:Maths.randomInt(0,this.w)};
  2175.       this.clip.level.bg.globalToLocal(_loc9_);
  2176.       clip._x = _loc9_.x;
  2177.       clip._y = _loc9_.y;
  2178.       clip._scale = Maths.randomNum(70,120);
  2179.       clip._rotation = Maths.randomInt(0,359);
  2180.       this.stars.push(clip);
  2181.       _loc17_ = _loc17_ + 1;
  2182.    }
  2183.    this.objPhysics.baseClip.onEnterFrame = undefined;
  2184.    this.clip.onEnterFrame = function()
  2185.    {
  2186.       this.objGame.evtEnterFrame();
  2187.    };
  2188.    Key.addListener(this);
  2189. };
  2190. ChoppaGame.prototype.evtEnterFrame = function()
  2191. {
  2192.    this.frame = this.frame + 1;
  2193.    var _loc4_ = 0;
  2194.    while(_loc4_ < this.stars.length)
  2195.    {
  2196.       var _loc3_ = this.stars[_loc4_];
  2197.       var _loc22_ = _loc3_.holderToGlobal();
  2198.       if(_loc22_.x < 0)
  2199.       {
  2200.          _loc3_._x += this.w;
  2201.       }
  2202.       if(_loc22_.y < 0)
  2203.       {
  2204.          _loc3_._y += this.h;
  2205.       }
  2206.       if(_loc22_.x > this.w)
  2207.       {
  2208.          _loc3_._x -= this.w;
  2209.       }
  2210.       if(_loc22_.y > this.h)
  2211.       {
  2212.          _loc3_._y -= this.h;
  2213.       }
  2214.       _loc4_ = _loc4_ + 1;
  2215.    }
  2216.    if(Key.isDown(Keys.Escape) && !_root.objTrans.transitioning)
  2217.    {
  2218.       _root.objSounds.play("rollover-tick");
  2219.       Key.removeListener(this);
  2220.       _root.objTrans.goto("picklevel");
  2221.    }
  2222.    if(Key.isDown(Keys.R) && !_root.objTrans.transitioning)
  2223.    {
  2224.       _root.objSounds.play("rollover-tick");
  2225.       Key.removeListener(this);
  2226.       _root.objTrans.goto("restart");
  2227.    }
  2228.    switch(this.state)
  2229.    {
  2230.       case "paused":
  2231.          this.frame = this.frame - 1;
  2232.          Mouse.show();
  2233.          break;
  2234.       case "flight":
  2235.          if(this.controls == "full")
  2236.          {
  2237.             Mouse.hide();
  2238.          }
  2239.          this.mRotor.extForceX = 0;
  2240.          this.mRotor.extForceY = 0;
  2241.          this.mCockpit.extForceX = 0;
  2242.          this.mCockpit.extForceY = 0;
  2243.          this.mTail.extForceX = 0;
  2244.          this.mTail.extForceY = 0;
  2245.          var _loc7_ = Math.cos(Maths.degToRad(this.clip.level.choppa._rotation - 90));
  2246.          var _loc6_ = Math.sin(Maths.degToRad(this.clip.level.choppa._rotation - 90));
  2247.          switch(this.controls)
  2248.          {
  2249.             case "easy":
  2250.                var _loc14_ = this.objPhysics.gravityX;
  2251.                var _loc13_ = this.objPhysics.gravityY;
  2252.                if(this.gravityCentreX != undefined)
  2253.                {
  2254.                   _loc14_ = this.gravityCentreX - this.clip.level.choppa._x;
  2255.                   _loc13_ = this.gravityCentreY - this.clip.level.choppa._y;
  2256.                }
  2257.                var _loc15_ = Maths.vectorLength(_loc14_,_loc13_);
  2258.                if(_loc15_ == 0)
  2259.                {
  2260.                   _loc15_ = 1;
  2261.                }
  2262.                _loc14_ /= _loc15_;
  2263.                _loc13_ /= _loc15_;
  2264.                thrustX = _loc14_ * (- this.idleLift);
  2265.                thrustY = _loc13_ * (- this.idleLift);
  2266.                if(Key.isDown(Keys.CursorUp) || Key.isDown(Keys.W))
  2267.                {
  2268.                   thrustY -= this.throttleLift;
  2269.                }
  2270.                if(Key.isDown(Keys.CursorDown) || Key.isDown(Keys.S))
  2271.                {
  2272.                   thrustY += this.idleLift;
  2273.                }
  2274.                if(Key.isDown(Keys.CursorLeft) || Key.isDown(Keys.A))
  2275.                {
  2276.                   thrustX -= this.throttleLiftLow;
  2277.                }
  2278.                if(Key.isDown(Keys.CursorRight) || Key.isDown(Keys.D))
  2279.                {
  2280.                   thrustX += this.throttleLiftLow;
  2281.                }
  2282.                thrustX /= 3;
  2283.                thrustY /= 3;
  2284.                this.mRotor.extForceX += thrustX * 1.3;
  2285.                this.mRotor.extForceY += thrustY;
  2286.                this.mCockpit.extForceX += thrustX;
  2287.                this.mCockpit.extForceY += thrustY;
  2288.                this.mTail.extForceX += thrustX;
  2289.                this.mTail.extForceY += thrustY;
  2290.                var _loc12_ = 0;
  2291.                var _loc25_ = Maths.dotProduct(_loc14_,_loc13_,- _loc6_,_loc7_);
  2292.                _loc12_ += 5 * _loc25_;
  2293.                if(Key.isDown(Keys.Z) || Key.isDown(Keys.Y))
  2294.                {
  2295.                   _loc12_ += 5 + this.leftCount++ / 10;
  2296.                }
  2297.                else
  2298.                {
  2299.                   this.leftCount = 0;
  2300.                }
  2301.                if(Key.isDown(Keys.X))
  2302.                {
  2303.                   _loc12_ -= 5 + this.rightCount++ / 10;
  2304.                }
  2305.                else
  2306.                {
  2307.                   this.rightCount = 0;
  2308.                }
  2309.                this.mCockpit.extForceX += _loc7_ * _loc12_ * this.torque;
  2310.                this.mCockpit.extForceY += _loc6_ * _loc12_ * this.torque;
  2311.                this.mTail.extForceX -= _loc7_ * _loc12_ * this.torque;
  2312.                this.mTail.extForceY -= _loc6_ * _loc12_ * this.torque;
  2313.                break;
  2314.             case "full":
  2315.                var _loc10_ = this.idleLift;
  2316.                var torque = this.torque;
  2317.                if(Key.isDown(Keys.CursorUp) || Keys.mouseDown() || Key.isDown(Keys.W))
  2318.                {
  2319.                   _loc10_ = this.throttleLift;
  2320.                }
  2321.                _loc10_ /= 3;
  2322.                this.mRotor.extForceX += _loc10_ * _loc7_;
  2323.                this.mRotor.extForceY += _loc10_ * _loc6_;
  2324.                this.mCockpit.extForceX += _loc10_ * _loc7_;
  2325.                this.mCockpit.extForceY += _loc10_ * _loc6_;
  2326.                this.mTail.extForceX += _loc10_ * _loc7_;
  2327.                this.mTail.extForceY += _loc10_ * _loc6_;
  2328.                _loc12_ = this.prevMouseX - _root._xmouse;
  2329.                var _loc26_ = this.prevMouseY - _root._ymouse;
  2330.                if(Key.isDown(Keys.CursorLeft) || Key.isDown(Keys.A))
  2331.                {
  2332.                   _loc12_ += 5 + this.leftCount++ / 10;
  2333.                }
  2334.                else
  2335.                {
  2336.                   this.leftCount = 0;
  2337.                }
  2338.                if(Key.isDown(Keys.CursorRight) || Key.isDown(Keys.D))
  2339.                {
  2340.                   _loc12_ -= 5 + this.rightCount++ / 10;
  2341.                }
  2342.                else
  2343.                {
  2344.                   this.rightCount = 0;
  2345.                }
  2346.                this.mCockpit.extForceX += _loc7_ * _loc12_ * torque * this.torqueAdjust;
  2347.                this.mCockpit.extForceY += _loc6_ * _loc12_ * torque * this.torqueAdjust;
  2348.                this.mTail.extForceX -= _loc7_ * _loc12_ * torque * this.torqueAdjust;
  2349.                this.mTail.extForceY -= _loc6_ * _loc12_ * torque * this.torqueAdjust;
  2350.          }
  2351.          this.bladeFrames = this.bladeFrames - 1;
  2352.          if(this.bladeFrames <= 0)
  2353.          {
  2354.             this.bladeFrames = 6;
  2355.             if(Key.isDown(Keys.CursorUp) || Key.isDown(Keys.W) || Key.isDown(Keys.CursorDown) || Key.isDown(Keys.S) || Key.isDown(Keys.CursorLeft) || Key.isDown(Keys.A) || Key.isDown(Keys.CursorRight) || Key.isDown(Keys.D) || Keys.mouseDown())
  2356.             {
  2357.                this.bladeFrames = 4;
  2358.             }
  2359.             _root.objSounds.play("blade");
  2360.          }
  2361.          this.objectsEnterFrame();
  2362.          this.objPhysics.step();
  2363.          this.paint();
  2364.          if(this.controls == "full" && !this.clip.gameHitZone.hitTest(_root._xmouse,_root._ymouse,true))
  2365.          {
  2366.             this.state = "paused";
  2367.             this.pauseObjects();
  2368.             this.clip.pausePanel.fadeIn(0.25);
  2369.             this.clip.pausePanel.objGame = this;
  2370.             this.clip.pausePanel.onRelease = function()
  2371.             {
  2372.                _root.objSounds.play("rollover-tick");
  2373.                this.objGame.unpauseObjects();
  2374.                this.objGame.state = "flight";
  2375.                this.fadeOut(0.25);
  2376.                this.onRelease = undefined;
  2377.                this.onRollOver = undefined;
  2378.             };
  2379.             this.clip.pausePanel.onRollOver = function()
  2380.             {
  2381.                _root.objSounds.play("rollover-tock");
  2382.             };
  2383.          }
  2384.          var _loc9_ = 0;
  2385.          if(this.mCockpit.hasHitSurface)
  2386.          {
  2387.             var _loc21_ = Maths.vectorLength(this.mCockpit.collisionNormal.x,this.mCockpit.collisionNormal.y);
  2388.             if(_loc21_ > _loc9_)
  2389.             {
  2390.                _loc9_ = _loc21_;
  2391.             }
  2392.          }
  2393.          if(this.mTail.hasHitSurface)
  2394.          {
  2395.             _loc21_ = Maths.vectorLength(this.mTail.collisionNormal.x,this.mTail.collisionNormal.y);
  2396.             if(_loc21_ > _loc9_)
  2397.             {
  2398.                _loc9_ = _loc21_;
  2399.             }
  2400.          }
  2401.          if(this.mRotor.hasHitSurface)
  2402.          {
  2403.             _loc21_ = Maths.vectorLength(this.mRotor.collisionNormal.x,this.mRotor.collisionNormal.y);
  2404.             if(_loc21_ > _loc9_)
  2405.             {
  2406.                _loc9_ = _loc21_;
  2407.             }
  2408.          }
  2409.          var _loc17_ = false;
  2410.          var _loc18_ = {x:this.mCockpit.x,y:this.mCockpit.y};
  2411.          var _loc20_ = {x:this.mRotor.x,y:this.mRotor.y};
  2412.          var _loc19_ = {x:this.mTail.x,y:this.mTail.y};
  2413.          this.clip.level.physics.localToGlobal(_loc18_);
  2414.          this.clip.level.physics.localToGlobal(_loc20_);
  2415.          this.clip.level.physics.localToGlobal(_loc19_);
  2416.          if(!this.clip.level.choppa.hitCockpit.hitTest(_loc18_.x,_loc18_.y,true))
  2417.          {
  2418.             _loc17_ = true;
  2419.          }
  2420.          if(!this.clip.level.choppa.hitRotor.hitTest(_loc20_.x,_loc20_.y,true))
  2421.          {
  2422.             _loc17_ = true;
  2423.          }
  2424.          if(!this.clip.level.choppa.hitTail.hitTest(_loc19_.x,_loc19_.y,true))
  2425.          {
  2426.             _loc17_ = true;
  2427.          }
  2428.          if(_loc17_)
  2429.          {
  2430.             this.choppaBrokenFrames = this.choppaBrokenFrames + 1;
  2431.          }
  2432.          else
  2433.          {
  2434.             this.choppaBrokenFrames = 0;
  2435.          }
  2436.          if(this.perfect && _loc9_ > 0 && !this.clip.level.choppa.hitTest(this.clip.level.flag))
  2437.          {
  2438.             this.perfect = false;
  2439.             this.clip.perfectIndicator.fadeOut(0.5);
  2440.          }
  2441.          if(this.frame == _root.arrLevels[_root.curLevelID].par)
  2442.          {
  2443.             this.clip.fastIndicator.fadeOut(0.5);
  2444.          }
  2445.          if(_loc9_ > 14 || this.choppaBrokenFrames > 20)
  2446.          {
  2447.             _root.trackPoint("Level_" + _root.curLevelID + "_crashed");
  2448.             if(_root.curLevelID == 19)
  2449.             {
  2450.                this.pauseObjects();
  2451.             }
  2452.             _root.objSounds.play("crashed");
  2453.             this.state = "crashed";
  2454.             this.clip.crashPanel.fadeIn(0.25);
  2455.             this.clip.crashPanel.objGame = this;
  2456.             this.clip.crashPanel.onRelease = function()
  2457.             {
  2458.                _root.objSounds.play("rollover-tick");
  2459.                _root.objTrans.goto("picklevel");
  2460.                Key.removeListener(this);
  2461.                this.onRelease = undefined;
  2462.                this.onRollOver = undefined;
  2463.             };
  2464.             this.clip.crashPanel.onRollOver = function()
  2465.             {
  2466.                _root.objSounds.play("rollover-tock");
  2467.             };
  2468.             return undefined;
  2469.          }
  2470.          if(this.mCockpit.hasHitSurface && this.mTail.hasHitSurface && this.clip.level.choppa.hitTest(this.clip.level.flag))
  2471.          {
  2472.             trace("Completed level " + _root.curLevelID + " in " + this.frame + " frames");
  2473.             var _loc16_ = false;
  2474.             if(this.frame < _root.arrLevels[_root.curLevelID].par)
  2475.             {
  2476.                _loc16_ = true;
  2477.             }
  2478.             if(this.hitBySam == true)
  2479.             {
  2480.                _root.achieved(3);
  2481.             }
  2482.             if(_root.curLevelID == 14 && !this.usedWinch)
  2483.             {
  2484.                _root.achieved(4);
  2485.             }
  2486.             if(_root.curLevelID == 15)
  2487.             {
  2488.                var _loc24_ = this.gooTop1.holderToGlobal();
  2489.                var _loc23_ = this.gooTop2.holderToGlobal();
  2490.                if(this.clip.level.towerHit.hitTest(_loc24_.x,_loc24_.y,true) && this.clip.level.towerHit.hitTest(_loc23_.x,_loc23_.y,true))
  2491.                {
  2492.                   _root.achieved(5);
  2493.                }
  2494.             }
  2495.             if(_root.curLevelID == 20)
  2496.             {
  2497.                _loc24_ = this.gooTop1.holderToGlobal();
  2498.                _loc23_ = this.gooTop2.holderToGlobal();
  2499.                if(this.clip.level.towerHit.hitTest(_loc24_.x,_loc24_.y,true) && this.clip.level.towerHit.hitTest(_loc23_.x,_loc23_.y,true))
  2500.                {
  2501.                   _root.achieved(6);
  2502.                }
  2503.             }
  2504.             if(_root.curLevelID == 21)
  2505.             {
  2506.                _root.achieved(7);
  2507.             }
  2508.             if(this.perfect)
  2509.             {
  2510.                _root.trackPoint("Level_" + _root.curLevelID + "_perfect");
  2511.                _root.objSounds.play("voice-perfect");
  2512.             }
  2513.             else if(_loc16_)
  2514.             {
  2515.                _root.trackPoint("Level_" + _root.curLevelID + "_fast");
  2516.                _root.objSounds.play("voice-reallyfast");
  2517.             }
  2518.             else
  2519.             {
  2520.                _root.trackPoint("Level_" + _root.curLevelID + "_completed");
  2521.                _root.objSounds.play("voice-complete");
  2522.             }
  2523.             passedLevel(_root.curLevelID,this.perfect,_loc16_);
  2524.             var _loc11_ = 0;
  2525.             var _loc5_ = 0;
  2526.             var _loc8_ = 0;
  2527.             _loc4_ = 0;
  2528.             while(_loc4_ < _root.arrLevels.length)
  2529.             {
  2530.                if(_root.arrLevels[_loc4_].passed)
  2531.                {
  2532.                   _loc11_ = _loc11_ + 1;
  2533.                }
  2534.                if(_root.arrLevels[_loc4_].perfect)
  2535.                {
  2536.                   _loc5_ = _loc5_ + 1;
  2537.                }
  2538.                if(_root.arrLevels[_loc4_].fast)
  2539.                {
  2540.                   _loc8_ = _loc8_ + 1;
  2541.                }
  2542.                _loc4_ = _loc4_ + 1;
  2543.             }
  2544.             if(_loc11_ >= 21)
  2545.             {
  2546.                _root.achieved(8);
  2547.             }
  2548.             if(_loc5_ >= 10)
  2549.             {
  2550.                _root.achieved(9);
  2551.             }
  2552.             if(_loc5_ >= 21)
  2553.             {
  2554.                _root.achieved(10);
  2555.             }
  2556.             if(_loc8_ >= 10)
  2557.             {
  2558.                _root.achieved(11);
  2559.             }
  2560.             if(_loc8_ >= 21)
  2561.             {
  2562.                _root.achieved(12);
  2563.             }
  2564.             this.state = "completed";
  2565.             this.pauseObjects();
  2566.             this.clip.winPanel.fadeIn(0.25);
  2567.             this.clip.winPanel.objGame = this;
  2568.             this.clip.winPanel.onRelease = function()
  2569.             {
  2570.                _root.objSounds.play("rollover-tick");
  2571.                _root.objTrans.goto("picklevel");
  2572.                Key.removeListener(this);
  2573.                this.onRelease = undefined;
  2574.                this.onRollOver = undefined;
  2575.             };
  2576.             this.clip.winPanel.onRollOver = function()
  2577.             {
  2578.                _root.objSounds.play("rollover-tock");
  2579.             };
  2580.             if(this.perfect)
  2581.             {
  2582.                trace("  Perfect!");
  2583.                this.clip.perfectPanel.fadeIn(1.5);
  2584.             }
  2585.             if(_loc16_)
  2586.             {
  2587.                trace("  Fast!");
  2588.                this.clip.fastPanel.fadeIn(1.5);
  2589.             }
  2590.          }
  2591.          break;
  2592.       case "crashed":
  2593.          Mouse.show();
  2594.          this.clip.level.choppa.stop();
  2595.          this.objectsEnterFrame();
  2596.          this.objPhysics.step();
  2597.          this.paint();
  2598.          if(Key.isDown(Keys.Enter))
  2599.          {
  2600.             this.clip.crashPanel.onRelease();
  2601.          }
  2602.          break;
  2603.       case "completed":
  2604.          if(Key.isDown(Keys.Enter))
  2605.          {
  2606.             this.clip.winPanel.onRelease();
  2607.          }
  2608.          Mouse.show();
  2609.          break;
  2610.       default:
  2611.          trace("Undefined state: " + this.state);
  2612.    }
  2613.    this.prevMouseX = _root._xmouse;
  2614.    this.prevMouseY = _root._ymouse;
  2615.    _loc22_ = this.clip.level.choppa.holderToLocal(this.clip.screenCentre);
  2616.    this.clip.level._x -= _loc22_.x / 4;
  2617.    this.clip.level._y -= _loc22_.y / 4;
  2618. };
  2619. ChoppaGame.prototype.objectsEnterFrame = function()
  2620. {
  2621.    var _loc17_ = this.clip.level.choppa.winch.holderToLocal(this.clip.level.physics);
  2622.    this.mWinchA.x = _loc17_.x;
  2623.    this.mWinchA.y = _loc17_.y;
  2624.    var _loc8_ = 0;
  2625.    while(_loc8_ < this.objPhysics.masses.length)
  2626.    {
  2627.       var _loc7_ = this.objPhysics.masses[_loc8_];
  2628.       if(_loc7_.soundFrames > 0)
  2629.       {
  2630.          _loc7_.soundFrames = _loc7_.soundFrames - 1;
  2631.          if(_loc7_.soundFrames <= 0)
  2632.          {
  2633.             _loc7_.soundFrames = undefined;
  2634.          }
  2635.       }
  2636.       if(_loc7_.collisionSound && _loc7_.hasHitSurface && _loc7_.soundFrames == undefined && (_loc7_.collisionNormal.x > 1 || _loc7_.collisionNormal.y > 1))
  2637.       {
  2638.          var _loc24_ = Maths.vectorLength(_loc7_.collisionNormal.x,_loc7_.collisionNormal.y);
  2639.          _root.objSounds.play(_loc7_.collisionSound,Math.min(100,_loc24_ * 5));
  2640.          _loc7_.soundFrames = 10;
  2641.       }
  2642.       _loc8_ = _loc8_ + 1;
  2643.    }
  2644.    var _loc26_ = 0;
  2645.    var clip = this.clip.level["b" + _loc26_];
  2646.    while(clip != undefined)
  2647.    {
  2648.       switch(clip.item)
  2649.       {
  2650.          case "oneton":
  2651.             break;
  2652.          case "scissors":
  2653.             if(clip.m_b.springs.length == 2)
  2654.             {
  2655.                _loc17_ = clip.f.holderToGlobal();
  2656.                _loc8_ = 0;
  2657.                var _loc3_ = this.clip.level["b" + _loc8_];
  2658.                while(_loc3_ != undefined)
  2659.                {
  2660.                   if(_loc3_.item == "hair")
  2661.                   {
  2662.                      if(_loc3_.cut < 4 && _loc3_.hitTest(_loc17_.x,_loc17_.y,true))
  2663.                      {
  2664.                         _loc3_.cut = _loc3_.cut + 1;
  2665.                         _loc3_.gotoAndStop("cut" + _loc3_.cut);
  2666.                         if(_loc3_.cut >= 4)
  2667.                         {
  2668.                            this.clip.level.flag._y -= 250;
  2669.                         }
  2670.                      }
  2671.                   }
  2672.                   _loc8_ = _loc8_ + 1;
  2673.                   _loc3_ = this.clip.level["b" + _loc8_];
  2674.                }
  2675.             }
  2676.             break;
  2677.          case "fan":
  2678.             _loc8_ = 0;
  2679.             while(_loc8_ < this.objPhysics.masses.length)
  2680.             {
  2681.                _loc7_ = this.objPhysics.masses[_loc8_];
  2682.                _loc17_ = {x:_loc7_.x,y:_loc7_.y};
  2683.                this.objPhysics.baseClip.localToGlobal(_loc17_);
  2684.                if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2685.                {
  2686.                   var _loc9_ = Maths.distance(clip._x,clip._y,_loc7_.x,_loc7_.y);
  2687.                   if(_loc9_ > clip.hit._width)
  2688.                   {
  2689.                      _loc9_ = clip.hit._width;
  2690.                   }
  2691.                   var _loc10_ = (clip.hit._width - _loc9_) / clip.hit._width;
  2692.                   _loc7_.extForceX += _loc10_ * clip.fanStrength * Math.cos(Maths.degToRad(clip._rotation));
  2693.                   _loc7_.extForceY += _loc10_ * clip.fanStrength * Math.sin(Maths.degToRad(clip._rotation));
  2694.                }
  2695.                _loc8_ = _loc8_ + 1;
  2696.             }
  2697.             break;
  2698.          case "wave":
  2699.             _loc8_ = 0;
  2700.             while(_loc8_ < this.objPhysics.masses.length)
  2701.             {
  2702.                _loc7_ = this.objPhysics.masses[_loc8_];
  2703.                _loc17_ = {x:_loc7_.x,y:_loc7_.y};
  2704.                this.objPhysics.baseClip.localToGlobal(_loc17_);
  2705.                if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2706.                {
  2707.                   _loc7_.extForceY -= this.gravity + 0.01 * _loc7_.radius;
  2708.                   _loc7_.vx *= 0.95;
  2709.                   _loc7_.vy *= 0.95;
  2710.                }
  2711.                _loc8_ = _loc8_ + 1;
  2712.             }
  2713.             break;
  2714.          case "hitchecker":
  2715.             _loc8_ = 0;
  2716.             while(_loc8_ < this.objPhysics.masses.length)
  2717.             {
  2718.                _loc7_ = this.objPhysics.masses[_loc8_];
  2719.                _loc17_ = {x:_loc7_.x,y:_loc7_.y};
  2720.                this.objPhysics.baseClip.localToGlobal(_loc17_);
  2721.                if(clip.hitTest(_loc17_.x,_loc17_.y,true))
  2722.                {
  2723.                   clip.massTouching(_loc7_);
  2724.                }
  2725.                _loc8_ = _loc8_ + 1;
  2726.             }
  2727.             break;
  2728.          case "button":
  2729.             if(clip.state == "off")
  2730.             {
  2731.                _loc8_ = 0;
  2732.                while(_loc8_ < this.objPhysics.masses.length)
  2733.                {
  2734.                   _loc7_ = this.objPhysics.masses[_loc8_];
  2735.                   _loc17_ = {x:_loc7_.x,y:_loc7_.y};
  2736.                   this.objPhysics.baseClip.localToGlobal(_loc17_);
  2737.                   if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2738.                   {
  2739.                      _root.objSounds.play("switch");
  2740.                      clip.evtTriggered();
  2741.                      clip.state = "on";
  2742.                      clip.gotoAndStop("on");
  2743.                   }
  2744.                   _loc8_ = _loc8_ + 1;
  2745.                }
  2746.             }
  2747.             break;
  2748.          case "ball":
  2749.          case "sailor":
  2750.             break;
  2751.          case "boat":
  2752.             if(this.menSaved && this.boatPositioned >= 2)
  2753.             {
  2754.                this.menSaved = false;
  2755.                this.clip.level.flag._y -= 1000;
  2756.                this.clip.level.flag._alpha = 0;
  2757.                this.clip.level.flag.fadeIn(0.5);
  2758.                this.clip.level.sign.gotoAndPlay("done");
  2759.             }
  2760.             this.boatPositioned = 0;
  2761.             break;
  2762.          case "sheep":
  2763.             clip.dirFrames--;
  2764.             if(clip.dirFrames <= 0)
  2765.             {
  2766.                clip.dir = Maths.randomNum(-0.3,0.3);
  2767.                clip.dirFrames = Maths.randomInt(30,100);
  2768.             }
  2769.             if(clip.objMass.hasHitSurface)
  2770.             {
  2771.                clip.objMass.extForceX = clip.dir;
  2772.             }
  2773.             break;
  2774.          case "sheeppen":
  2775.             var _loc14_ = 0;
  2776.             _loc8_ = 0;
  2777.             while(_loc8_ < this.objPhysics.masses.length)
  2778.             {
  2779.                _loc7_ = this.objPhysics.masses[_loc8_];
  2780.                if(_loc7_.isSheep)
  2781.                {
  2782.                   _loc17_ = {x:_loc7_.x,y:_loc7_.y};
  2783.                   this.objPhysics.baseClip.localToGlobal(_loc17_);
  2784.                   if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2785.                   {
  2786.                      _loc14_ = _loc14_ + 1;
  2787.                   }
  2788.                }
  2789.                _loc8_ = _loc8_ + 1;
  2790.             }
  2791.             clip.sheepDeposited(_loc14_);
  2792.             break;
  2793.          case "platform":
  2794.             var _loc11_ = 0;
  2795.             _loc8_ = 0;
  2796.             while(_loc8_ < this.objPhysics.masses.length)
  2797.             {
  2798.                _loc7_ = this.objPhysics.masses[_loc8_];
  2799.                if(_loc7_.isSailor)
  2800.                {
  2801.                   _loc17_ = {x:_loc7_.x,y:_loc7_.y};
  2802.                   this.objPhysics.baseClip.localToGlobal(_loc17_);
  2803.                   if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2804.                   {
  2805.                      _loc11_ = _loc11_ + 1;
  2806.                   }
  2807.                }
  2808.                _loc8_ = _loc8_ + 1;
  2809.             }
  2810.             clip.sailorsDeposited(_loc11_);
  2811.             break;
  2812.          case "hover":
  2813.             _loc17_ = this.clip.level.choppa.holderToGlobal();
  2814.             if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2815.             {
  2816.                clip.gotoAndStop("hover");
  2817.             }
  2818.             else
  2819.             {
  2820.                clip.gotoAndStop("idle");
  2821.             }
  2822.             break;
  2823.          case "net":
  2824.             if(clip.state == "untriggered")
  2825.             {
  2826.                _loc17_ = this.clip.level.choppa.holderToGlobal();
  2827.                if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2828.                {
  2829.                   clip.state = "triggered";
  2830.                   _root.objSounds.play("net-fall");
  2831.                   var _loc6_ = 0;
  2832.                   while(_loc6_ < clip.masses.length)
  2833.                   {
  2834.                      clip.masses[_loc6_].fixed = false;
  2835.                      _loc6_ = _loc6_ + 1;
  2836.                   }
  2837.                }
  2838.             }
  2839.             break;
  2840.          case "bee":
  2841.             clip.targetR += clip.targetDR;
  2842.             var _loc25_ = clip.targetX + clip.targetRadius * Math.cos(clip.targetR);
  2843.             var _loc22_ = clip.targetY + clip.targetRadius * Math.sin(clip.targetR);
  2844.             var _loc13_ = clip.objMass.x - _loc25_;
  2845.             var _loc12_ = clip.objMass.y - _loc22_;
  2846.             var _loc23_ = (- _loc13_) / 70;
  2847.             var _loc21_ = (- _loc12_) / 70;
  2848.             clip.objMass.extForceX += _loc23_;
  2849.             clip.objMass.extForceY += _loc21_;
  2850.             break;
  2851.          case "gravitywell":
  2852.             _loc8_ = 0;
  2853.             while(_loc8_ < this.objPhysics.masses.length)
  2854.             {
  2855.                var _loc5_ = this.objPhysics.masses[_loc8_];
  2856.                _loc13_ = _loc5_.x - clip._x;
  2857.                _loc12_ = _loc5_.y - clip._y;
  2858.                var _loc15_ = Maths.vectorLength(_loc13_,_loc12_);
  2859.                _loc13_ /= _loc15_;
  2860.                _loc12_ /= _loc15_;
  2861.                _loc13_ *= this.gravity;
  2862.                _loc12_ *= this.gravity;
  2863.                _loc5_.extForceX -= _loc13_;
  2864.                _loc5_.extForceY -= _loc12_;
  2865.                _loc8_ = _loc8_ + 1;
  2866.             }
  2867.             break;
  2868.          case "mixer":
  2869.             if(this.mRotor.hasHitSurface || this.mTail.hasHitSurface || this.mCockpit.hasHitSurface)
  2870.             {
  2871.                clip.dr -= 0.005;
  2872.             }
  2873.             else
  2874.             {
  2875.                clip.dr += 0.005;
  2876.             }
  2877.             if(clip.dr < 0.1)
  2878.             {
  2879.                clip.dr = 0.1;
  2880.             }
  2881.             if(clip.dr > 0.5)
  2882.             {
  2883.                clip.dr = 0.5;
  2884.             }
  2885.             clip._rotation += clip.dr;
  2886.             _loc8_ = 0;
  2887.             while(_loc8_ < clip.surfaces.length)
  2888.             {
  2889.                clip.surfaces[_loc8_].removeSurface();
  2890.                _loc8_ = _loc8_ + 1;
  2891.             }
  2892.             clip.surfaces = addSurfaces(clip,"s",this.objPhysics,0.9,0.95);
  2893.             break;
  2894.          case "crushotron":
  2895.             _loc8_ = 0;
  2896.             while(_loc8_ < clip.lSurfaces.length)
  2897.             {
  2898.                clip.lSurfaces[_loc8_].removeSurface();
  2899.                _loc8_ = _loc8_ + 1;
  2900.             }
  2901.             _loc8_ = 0;
  2902.             while(_loc8_ < clip.rSurfaces.length)
  2903.             {
  2904.                clip.rSurfaces[_loc8_].removeSurface();
  2905.                _loc8_ = _loc8_ + 1;
  2906.             }
  2907.             clip.lSurfaces = addSurfaces(clip.l,"s",this.objPhysics,0.9,0.95);
  2908.             clip.rSurfaces = addSurfaces(clip.r,"s",this.objPhysics,0.9,0.95);
  2909.             break;
  2910.          case "lift":
  2911.             _loc8_ = 0;
  2912.             while(_loc8_ < clip.surfaces.length)
  2913.             {
  2914.                clip.surfaces[_loc8_].removeSurface();
  2915.                _loc8_ = _loc8_ + 1;
  2916.             }
  2917.             clip.surfaces = addSurfaces(clip.lift,"s",this.objPhysics,0.9,0.95);
  2918.             break;
  2919.          case "sam":
  2920.             if(!clip.rocketAway)
  2921.             {
  2922.                _loc17_ = this.clip.level.choppa.holderToGlobal();
  2923.                if(clip.hit.hitTest(_loc17_.x,_loc17_.y,true))
  2924.                {
  2925.                   _root.objSounds.play("sam-launch");
  2926.                   var _loc4_ = this.clip.level["b" + clip.rocketID];
  2927.                   var _loc20_ = clip.sam.holderToLocal(this.clip.level.physics);
  2928.                   var _loc16_ = clip.holderToLocal(this.clip.level.physics);
  2929.                   _loc4_.objLine.m_f.x = _loc20_.x;
  2930.                   _loc4_.objLine.m_f.y = _loc20_.y;
  2931.                   _loc4_.objLine.m_b.x = _loc16_.x;
  2932.                   _loc4_.objLine.m_b.y = _loc16_.y;
  2933.                   _loc4_.objLine.m_f.vx = 0;
  2934.                   _loc4_.objLine.m_f.vy = 0;
  2935.                   _loc4_.objLine.m_b.vx = 0;
  2936.                   _loc4_.objLine.m_b.vy = 0;
  2937.                   _loc4_.active = true;
  2938.                   _loc4_._visible = true;
  2939.                   clip.rocketAway = true;
  2940.                }
  2941.             }
  2942.             break;
  2943.          case "rocket":
  2944.             if(clip.active)
  2945.             {
  2946.                clip.objLine.m_f.extForceY -= this.gravity;
  2947.                clip.objLine.m_b.extForceY -= this.gravity;
  2948.                _loc13_ = clip.objLine.m_f.x - clip.objLine.m_b.x;
  2949.                _loc12_ = clip.objLine.m_f.y - clip.objLine.m_b.y;
  2950.                _loc15_ = Maths.vectorLength(_loc13_,_loc12_);
  2951.                _loc13_ /= _loc15_;
  2952.                _loc12_ /= _loc15_;
  2953.                clip.objLine.m_f.extForceX += _loc13_ / 6;
  2954.                clip.objLine.m_f.extForceY += _loc12_ / 6;
  2955.                clip.objLine.m_b.extForceX += _loc13_ / 4;
  2956.                clip.objLine.m_b.extForceY += _loc12_ / 4;
  2957.                _loc13_ = clip.objLine.m_f.x - this.clip.level.choppa._x;
  2958.                _loc12_ = clip.objLine.m_f.y - this.clip.level.choppa._y;
  2959.                _loc15_ = Maths.vectorLength(_loc13_,_loc12_);
  2960.                _loc13_ /= _loc15_;
  2961.                _loc12_ /= _loc15_;
  2962.                clip.objLine.m_f.extForceX -= _loc13_ / 6;
  2963.                clip.objLine.m_f.extForceY -= _loc12_ / 6;
  2964.             }
  2965.             else
  2966.             {
  2967.                clip.objLine.m_f.x = clip.objLine.m_f.idleX;
  2968.                clip.objLine.m_f.y = clip.objLine.m_f.idleY;
  2969.                clip.objLine.m_b.x = clip.objLine.m_b.idleX;
  2970.                clip.objLine.m_b.y = clip.objLine.m_b.idleY;
  2971.             }
  2972.       }
  2973.       _loc26_ = _loc26_ + 1;
  2974.       clip = this.clip.level["b" + _loc26_];
  2975.    }
  2976. };
  2977. ChoppaGame.prototype.alignGravityMark = function(clip)
  2978. {
  2979.    var _loc3_ = this.clip.level.choppa._x - this.clip.level.b0._x;
  2980.    var _loc2_ = this.clip.level.choppa._y - this.clip.level.b0._y;
  2981.    var _loc4_ = Math.atan2(_loc2_,_loc3_);
  2982.    var _loc5_ = Maths.radToDeg(_loc4_) + Maths.randomNum(-30,30);
  2983.    clip._rotation = _loc5_;
  2984. };
  2985. ChoppaGame.prototype.paint = function()
  2986. {
  2987.    this.clip.level.drawing.clear();
  2988.    var p = this.slFront.getPosition();
  2989.    this.clip.level.choppa._x = this.mRotor.x;
  2990.    this.clip.level.choppa._y = this.mRotor.y;
  2991.    this.clip.level.choppa._rotation = p.rDeg + this.choppaRotationOffset;
  2992.    var j = 0;
  2993.    var clip = this.clip.level["b" + j];
  2994.    while(clip != undefined)
  2995.    {
  2996.       switch(clip.item)
  2997.       {
  2998.          case "oneton":
  2999.             var p = clip.objBox.getPosition();
  3000.             clip._x = p.x;
  3001.             clip._y = p.y;
  3002.             clip._rotation = p.rDeg + 90;
  3003.             break;
  3004.          case "magnet":
  3005.             var p = clip.objLine.getPosition();
  3006.             clip._x = p.x;
  3007.             clip._y = p.y;
  3008.             clip._rotation = p.rDeg + 180;
  3009.             break;
  3010.          case "scissors":
  3011.             var p = clip.objLine.getPosition();
  3012.             clip._x = p.x;
  3013.             clip._y = p.y;
  3014.             clip._rotation = p.rDeg;
  3015.             if(clip.m_b.springs.length == 2)
  3016.             {
  3017.                clip.gotoAndStop("chopping");
  3018.             }
  3019.             else
  3020.             {
  3021.                clip.gotoAndStop("stopped");
  3022.             }
  3023.             break;
  3024.          case "ball":
  3025.             clip._x = clip.objMass.x;
  3026.             clip._y = clip.objMass.y;
  3027.             break;
  3028.          case "sailor":
  3029.             clip._x = clip.objMass.x;
  3030.             clip._y = clip.objMass.y;
  3031.             break;
  3032.          case "sheep":
  3033.             clip._x = clip.objMass.x;
  3034.             clip._y = clip.objMass.y;
  3035.             clip._xscale = clip.dir < 0 ? 100 : -100;
  3036.             break;
  3037.          case "bee":
  3038.             clip._x = clip.objMass.x;
  3039.             clip._y = clip.objMass.y;
  3040.             break;
  3041.          case "rocket":
  3042.             if(clip.active)
  3043.             {
  3044.                var p = clip.objLine.getPosition();
  3045.                clip._x = p.x;
  3046.                clip._y = p.y;
  3047.                clip._rotation = p.rDeg;
  3048.             }
  3049.             break;
  3050.          case "net":
  3051.             this.clip.level.drawing.lineStyle(12,16737792,100);
  3052.             this.clip.level.drawing.moveTo(clip.masses[0].x,clip.masses[0].y);
  3053.             var n = 1;
  3054.             while(n < clip.masses.length)
  3055.             {
  3056.                this.clip.level.drawing.lineTo(clip.masses[n].x,clip.masses[n].y);
  3057.                n++;
  3058.             }
  3059.             break;
  3060.          case "gootower":
  3061.             var k = 0;
  3062.             while(k < clip.masses.length)
  3063.             {
  3064.                var mass = clip.masses[k];
  3065.                mass.gooClip._x = mass.x;
  3066.                mass.gooClip._y = mass.y;
  3067.                var h = 0;
  3068.                while(h < mass.springs.length)
  3069.                {
  3070.                   var m1 = mass.springs[h].mass1;
  3071.                   var m2 = mass.springs[h].mass2;
  3072.                   if(!(!m1.isGoo || !m2.isGoo))
  3073.                   {
  3074.                      this.clip.level.drawing.lineStyle(9,16737792,100);
  3075.                      this.clip.level.drawing.moveTo(m1.x,m1.y);
  3076.                      this.clip.level.drawing.lineTo(m2.x,m2.y);
  3077.                   }
  3078.                   h++;
  3079.                }
  3080.                k++;
  3081.             }
  3082.             break;
  3083.          case "boat":
  3084.             this.clip.level.drawing.lineStyle(9,0,100);
  3085.             this.clip.level.drawing.beginFill(16737792,100);
  3086.             this.clip.level.drawing.moveTo(clip.m0.x,clip.m0.y);
  3087.             this.clip.level.drawing.lineTo(clip.m1.x,clip.m1.y);
  3088.             this.clip.level.drawing.lineTo(clip.m2.x,clip.m2.y);
  3089.             this.clip.level.drawing.lineTo(clip.m3.x,clip.m3.y);
  3090.             this.clip.level.drawing.lineTo(clip.m4.x,clip.m4.y);
  3091.             this.clip.level.drawing.lineTo(clip.m5.x,clip.m5.y);
  3092.             this.clip.level.drawing.lineTo(clip.m6.x,clip.m6.y);
  3093.             this.clip.level.drawing.lineTo(clip.m0.x,clip.m0.y);
  3094.             this.clip.level.drawing.endFill();
  3095.             var p = clip.plaque.getPosition();
  3096.             this.clip.level.hmsFragile._x = p.x;
  3097.             this.clip.level.hmsFragile._y = p.y;
  3098.             this.clip.level.hmsFragile._rotation = p.rDeg + 180;
  3099.             break;
  3100.          case "handle":
  3101.             var dx = clip.mHandle.x - clip.mHub.x;
  3102.             var dy = clip.mHandle.y - clip.mHub.y;
  3103.             var angleRad = Math.atan2(dy,dx) - 1.5707963267948966;
  3104.             var angleDeg = Maths.radToDeg(angleRad);
  3105.             clip.arm._rotation = angleDeg;
  3106.             clip.arm.handle._rotation = - angleDeg;
  3107.             var dr = clip.prevAngle - clip.arm._rotation;
  3108.             if(dr < -100)
  3109.             {
  3110.                dr = 0;
  3111.             }
  3112.             if(dr < -5)
  3113.             {
  3114.                dr = -5;
  3115.             }
  3116.             if(dr > 100)
  3117.             {
  3118.                dr = 0;
  3119.             }
  3120.             if(dr > 5)
  3121.             {
  3122.                dr = 5;
  3123.             }
  3124.             _root.objSounds.volume("ratchet-loop",Math.abs(20 * dr));
  3125.             clip.angleChanged(dr);
  3126.             clip.prevAngle = clip.arm._rotation;
  3127.             break;
  3128.          case "oven":
  3129.             var k = 0;
  3130.             while(k < this.objPhysics.masses.length)
  3131.             {
  3132.                var mass = this.objPhysics.masses[k];
  3133.                if(mass.clip.ingredient != undefined)
  3134.                {
  3135.                   var p = {x:mass.x,y:mass.y};
  3136.                   this.clip.level.physics.localToGlobal(p);
  3137.                   if(clip.hit.hitTest(p.x,p.y,true))
  3138.                   {
  3139.                      clip.hit.evtItemHit(mass.clip);
  3140.                   }
  3141.                }
  3142.                k++;
  3143.             }
  3144.       }
  3145.       j++;
  3146.       clip = this.clip.level["b" + j];
  3147.    }
  3148.    if(this.winchState == "deployed")
  3149.    {
  3150.       var p = this.clip.level.choppa.winch.holderToLocal(this.clip.level.drawing);
  3151.       with(this.clip.level.drawing)
  3152.       {
  3153.          lineStyle(3,16737792,100);
  3154.          moveTo(p.x,p.y);
  3155.          lineTo(this.mWinchB.x,this.mWinchB.y);
  3156.          lineTo(this.mWinchC.x,this.mWinchC.y);
  3157.          lineTo(this.sWinchC.mass2.x,this.sWinchC.mass2.y);
  3158.       }
  3159.       if(this.sWinchC.mass2.removed)
  3160.       {
  3161.          this.toggleWinch();
  3162.       }
  3163.    }
  3164. };
  3165. ChoppaGame.prototype.createExplosion = function(x, y, force, forceRange)
  3166. {
  3167.    var _loc11_ = this.clip.level.drawing.getNextHighestDepth();
  3168.    this.clip.level.drawing.attachMovie("explosion","explosion" + _loc11_,_loc11_);
  3169.    var _loc12_ = this.clip.level.drawing["explosion" + _loc11_];
  3170.    _loc12_._x = x;
  3171.    _loc12_._y = y;
  3172.    var _loc6_ = 0;
  3173.    while(_loc6_ < this.objPhysics.masses.length)
  3174.    {
  3175.       var _loc2_ = this.objPhysics.masses[_loc6_];
  3176.       var _loc5_ = x - _loc2_.x;
  3177.       var _loc4_ = y - _loc2_.y;
  3178.       var _loc3_ = Maths.vectorLength(_loc5_,_loc4_);
  3179.       _loc5_ /= _loc3_;
  3180.       _loc4_ /= _loc3_;
  3181.       if(_loc3_ < forceRange)
  3182.       {
  3183.          _loc2_.vx -= force * _loc5_;
  3184.          _loc2_.vy -= force * _loc4_;
  3185.       }
  3186.       _loc6_ = _loc6_ + 1;
  3187.    }
  3188. };
  3189. ChoppaGame.prototype.onKeyUp = function()
  3190. {
  3191.    switch(Key.getCode())
  3192.    {
  3193.       case 13:
  3194.       case 32:
  3195.          switch(this.state)
  3196.          {
  3197.             case "flight":
  3198.                this.toggleWinch();
  3199.                break;
  3200.             case "completed":
  3201.             case "crashed":
  3202.          }
  3203.    }
  3204. };
  3205. ChoppaGame.prototype.toggleWinch = function()
  3206. {
  3207.    if(this.state != "flight")
  3208.    {
  3209.       return undefined;
  3210.    }
  3211.    switch(this.winchState)
  3212.    {
  3213.       case "idle":
  3214.          this.usedWinch = true;
  3215.          this.winchState = "deployed";
  3216.          this.idleLift = this.winchIdle;
  3217.          this.throttleLift = this.winchThrottle;
  3218.          _root.objSounds.play("winch-deploy");
  3219.          var _loc4_ = this.clip.level.choppa.winch.holderToLocal(this.clip.level.physics);
  3220.          var _loc3_ = this.clip.level.choppa.pulley.holderToLocal(this.clip.level.physics);
  3221.          this.mWinchA = new Mass(_loc4_.x,_loc4_.y,5,true,this.objPhysics,-1);
  3222.          this.mWinchB = new Mass(_loc3_.x,_loc3_.y,5,false,this.objPhysics,-1);
  3223.          this.mWinchC = new Mass(_loc4_.x,_loc4_.y,5,false,this.objPhysics,-1);
  3224.          this.mWinchD = new Mass(_loc3_.x,_loc3_.y,5,false,this.objPhysics,-1);
  3225.          this.sWinchA = new Spring(this.mWinchA,this.mWinchB,this.objPhysics,0.5,0.7);
  3226.          this.sWinchB = new Spring(this.mWinchB,this.mWinchC,this.objPhysics,0.5,0.7);
  3227.          this.sWinchC = new Spring(this.mWinchC,this.mWinchD,this.objPhysics,0.5,0.7);
  3228.          this.mWinchD.objGame = this;
  3229.          this.mWinchD.collisionCallback = function(otherMass)
  3230.          {
  3231.             if(otherMass.isNotWinchable)
  3232.             {
  3233.                return undefined;
  3234.             }
  3235.             if(otherMass.isSheep)
  3236.             {
  3237.                _root.objSounds.play("baa");
  3238.             }
  3239.             _root.objSounds.play("winch-attach");
  3240.             this.objGame.sWinchC.removeSpring();
  3241.             this.objGame.sWinchC = new Spring(this.objGame.mWinchC,otherMass,this.objGame.objPhysics,0.5,0.7);
  3242.             this.removeMass();
  3243.          };
  3244.          break;
  3245.       case "deployed":
  3246.          this.winchState = "idle";
  3247.          this.idleLift = this.standardIdle;
  3248.          this.throttleLift = this.standardThrottle;
  3249.          _root.objSounds.play("winch-retract");
  3250.          this.mWinchD.removeMass();
  3251.          this.mWinchC.removeMass();
  3252.          this.mWinchB.removeMass();
  3253.          this.mWinchA.removeMass();
  3254.    }
  3255. };
  3256. ChoppaGame.prototype.pauseObjects = function()
  3257. {
  3258.    var _loc3_ = 0;
  3259.    var _loc2_ = this.clip.level["b" + _loc3_];
  3260.    while(_loc2_ != undefined)
  3261.    {
  3262.       switch(_loc2_.item)
  3263.       {
  3264.          case "lift":
  3265.          case "wave":
  3266.          case "crushotron":
  3267.             _loc2_.stop();
  3268.             break;
  3269.       }
  3270.       _loc3_ = _loc3_ + 1;
  3271.       _loc2_ = this.clip.level["b" + _loc3_];
  3272.    }
  3273. };
  3274. ChoppaGame.prototype.unpauseObjects = function()
  3275. {
  3276.    var _loc3_ = 0;
  3277.    var _loc2_ = this.clip.level["b" + _loc3_];
  3278.    while(_loc2_ != undefined)
  3279.    {
  3280.       switch(_loc2_.item)
  3281.       {
  3282.          case "lift":
  3283.             if(_loc2_._currentframe < _loc2_._totalframes)
  3284.             {
  3285.                _loc2_.play();
  3286.             }
  3287.             break;
  3288.          case "wave":
  3289.          case "crushotron":
  3290.             _loc2_.play();
  3291.             break;
  3292.       }
  3293.       _loc3_ = _loc3_ + 1;
  3294.       _loc2_ = this.clip.level["b" + _loc3_];
  3295.    }
  3296. };
  3297. ChoppaGame.prototype.raiseHandle = function()
  3298. {
  3299.    this.handleClip._visible = true;
  3300.    this.handleClip.slideTo("0","-340",1.5,"easeInOutSine",0,function()
  3301.    {
  3302.       _root.objGame.handleClip.mHub.y -= 340;
  3303.       _root.objGame.handleClip.mHandle.y -= 340;
  3304.    }
  3305.    );
  3306.    this.clip.level.b1.gotoAndStop("raise");
  3307. };
  3308. ChoppaGame.prototype.handleComplete = function()
  3309. {
  3310.    this.clip.level.flag.slideTo("0","-100",1.5,"easeInOutSine");
  3311. };
  3312. ChoppaGame.prototype.makeGooTower = function(clip, stories, separation, k, d)
  3313. {
  3314.    clip.masses = [];
  3315.    clip.b0._visible = false;
  3316.    clip.b1._visible = false;
  3317.    var _loc9_ = clip.b0.holderToLocal(this.clip.level.physics);
  3318.    var _loc8_ = clip.b1.holderToLocal(this.clip.level.physics);
  3319.    var _loc7_ = new Mass(_loc9_.x,_loc9_.y,19,true,this.objPhysics,-1);
  3320.    var _loc6_ = new Mass(_loc8_.x,_loc8_.y,19,true,this.objPhysics,-1);
  3321.    _loc7_.isGoo = true;
  3322.    _loc6_.isGoo = true;
  3323.    clip.masses.push(_loc7_);
  3324.    clip.masses.push(_loc6_);
  3325.    var _loc15_ = this.clip.level.physics.getNextHighestDepth();
  3326.    var _loc5_ = 0;
  3327.    while(_loc5_ < stories)
  3328.    {
  3329.       _loc9_.y -= separation;
  3330.       _loc8_.y -= separation;
  3331.       var _loc3_ = new Mass(_loc9_.x,_loc9_.y,19,false,this.objPhysics,_loc15_);
  3332.       var _loc2_ = new Mass(_loc8_.x,_loc8_.y,19,false,this.objPhysics,_loc15_);
  3333.       _loc3_.mass = 2;
  3334.       _loc2_.mass = 2;
  3335.       _loc3_.isGoo = true;
  3336.       _loc2_.isGoo = true;
  3337.       _loc3_.collisionSound = "bee-squish";
  3338.       _loc2_.collisionSound = "bee-squish";
  3339.       var _loc4_ = this.clip.level.drawing.getNextHighestDepth();
  3340.       this.clip.level.drawing.attachMovie("gooball","gooball" + _loc4_,_loc4_);
  3341.       var _loc14_ = this.clip.level.drawing["gooball" + _loc4_];
  3342.       _loc4_ = this.clip.level.drawing.getNextHighestDepth();
  3343.       this.clip.level.drawing.attachMovie("gooball","gooball" + _loc4_,_loc4_);
  3344.       var _loc13_ = this.clip.level.drawing["gooball" + _loc4_];
  3345.       _loc3_.gooClip = _loc14_;
  3346.       _loc2_.gooClip = _loc13_;
  3347.       _loc3_.gooClip._x = _loc3_.x;
  3348.       _loc3_.gooClip._y = _loc3_.y;
  3349.       _loc2_.gooClip._x = _loc2_.x;
  3350.       _loc2_.gooClip._y = _loc2_.y;
  3351.       _loc3_.gooClip._rotation = Maths.randomInt(-20,20);
  3352.       _loc2_.gooClip._rotation = Maths.randomInt(-20,20);
  3353.       var _loc16_ = new Spring(_loc3_,_loc2_,this.objPhysics,k,d);
  3354.       _loc16_ = new Spring(_loc3_,_loc6_,this.objPhysics,k,d);
  3355.       _loc16_ = new Spring(_loc7_,_loc2_,this.objPhysics,k,d);
  3356.       _loc16_ = new Spring(_loc3_,_loc7_,this.objPhysics,0.6,0.4);
  3357.       _loc16_ = new Spring(_loc2_,_loc6_,this.objPhysics,0.6,0.4);
  3358.       clip.masses.push(_loc3_);
  3359.       clip.masses.push(_loc2_);
  3360.       _loc7_ = _loc3_;
  3361.       _loc6_ = _loc2_;
  3362.       _loc5_ = _loc5_ + 1;
  3363.    }
  3364.    this.gooTop1 = _loc7_.gooClip;
  3365.    this.gooTop2 = _loc6_.gooClip;
  3366. };
  3367. ChoppaGame.prototype.evt = function()
  3368. {
  3369. };
  3370. _root.Datacap = function(formID, thirdPartySubmit)
  3371. {
  3372.    this.formID = formID;
  3373.    this.thirdPartySubmit = thirdPartySubmit;
  3374.    this.controls = [];
  3375.    this.formInstance = undefined;
  3376.    this.sendingFrame = "";
  3377.    this.successFrame = "";
  3378.    this.failureFrame = "";
  3379.    this.userID = 0;
  3380.    this.customIsValid = undefined;
  3381.    this.preSubmit = undefined;
  3382.    this.onSuccess = undefined;
  3383.    this.onFailure = undefined;
  3384.    this.datacapURL = "http://www.deeperbeige.com/datacap/datacap";
  3385.    if(_level0.debug)
  3386.    {
  3387.       trace("Creating data form, ID=" + formID);
  3388.    }
  3389.    var _loc4_ = SharedObject.getLocal("cmuDatacap");
  3390.    if(_loc4_.data.userID == undefined)
  3391.    {
  3392.       _loc4_.data.userID = Math.floor(Math.random() * 100000000) + 100000000;
  3393.    }
  3394.    this.userID = _loc4_.data.userID;
  3395.    _loc4_.flush();
  3396.    this.registerTextbox = function(varName, instance, errorMarker)
  3397.    {
  3398.       if(_level0.debug)
  3399.       {
  3400.          trace("Registered textbox " + varName + " errorMarker=" + errorMarker);
  3401.       }
  3402.       if(instance == undefined)
  3403.       {
  3404.          trace("Error: Instance not found for textbox " + varName + "");
  3405.       }
  3406.       this.controls.push({style:"textbox",varName:varName,instance:instance,errorMarker:errorMarker,isValid:this.validateTextbox,autoFill:this.autoFillTextbox});
  3407.       instance.tabIndex = this.controls.length;
  3408.       instance.objForm = this;
  3409.       errorMarker._visible = false;
  3410.    };
  3411.    this.validateTextbox = function(control)
  3412.    {
  3413.       if(control.errorMarker != undefined)
  3414.       {
  3415.          if(control.instance.text == undefined || control.instance.text == "")
  3416.          {
  3417.             if(_level0.debug)
  3418.             {
  3419.                trace("Validating " + control.style + " " + control.varName + ": Invalid");
  3420.             }
  3421.             control.errorMarker._visible = true;
  3422.             return false;
  3423.          }
  3424.          if(_level0.debug)
  3425.          {
  3426.             trace("Validating " + control.style + " " + control.varName + ": Valid");
  3427.          }
  3428.          control.errorMarker._visible = false;
  3429.          return true;
  3430.       }
  3431.       return true;
  3432.    };
  3433.    this.autoFillTextbox = function(control)
  3434.    {
  3435.       var _loc1_ = SharedObject.getLocal("cmuDatacap");
  3436.       if(_loc1_.data[control.varName] != undefined)
  3437.       {
  3438.          control.instance.text = _loc1_.data[control.varName];
  3439.       }
  3440.    };
  3441.    this.registerEmailbox = function(varName, instance, errorMarker)
  3442.    {
  3443.       if(_level0.debug)
  3444.       {
  3445.          trace("Registered emailbox " + varName + " errorMarker=" + errorMarker);
  3446.       }
  3447.       if(instance == undefined)
  3448.       {
  3449.          trace("Error: Instance not found for emailbox " + varName + "");
  3450.       }
  3451.       this.controls.push({style:"emailbox",varName:varName,instance:instance,errorMarker:errorMarker,isValid:this.validateEmailbox,autoFill:this.autoFillEmailbox});
  3452.       instance.tabIndex = this.controls.length;
  3453.       instance.objForm = this;
  3454.       errorMarker._visible = false;
  3455.    };
  3456.    this.validateEmailbox = function(control)
  3457.    {
  3458.       if(control.errorMarker != undefined)
  3459.       {
  3460.          var _loc3_ = true;
  3461.          if(control.instance.text == undefined)
  3462.          {
  3463.             _loc3_ = false;
  3464.          }
  3465.          if(control.instance.text == "")
  3466.          {
  3467.             _loc3_ = false;
  3468.          }
  3469.          var _loc5_ = control.instance.text.split("@");
  3470.          if(_loc5_.length != 2)
  3471.          {
  3472.             _loc3_ = false;
  3473.          }
  3474.          if(_loc5_[0] == "")
  3475.          {
  3476.             _loc3_ = false;
  3477.          }
  3478.          var _loc2_ = _loc5_[1].split(".");
  3479.          if(_loc2_.length < 2)
  3480.          {
  3481.             _loc3_ = false;
  3482.          }
  3483.          var _loc1_ = 0;
  3484.          while(_loc1_ < _loc2_.length)
  3485.          {
  3486.             if(_loc2_[_loc1_] == "")
  3487.             {
  3488.                _loc3_ = false;
  3489.             }
  3490.             _loc1_ = _loc1_ + 1;
  3491.          }
  3492.          if(_loc3_)
  3493.          {
  3494.             if(_level0.debug)
  3495.             {
  3496.                trace("Validating " + control.style + " " + control.varName + ": Invalid");
  3497.             }
  3498.             control.errorMarker._visible = false;
  3499.             return true;
  3500.          }
  3501.          if(_level0.debug)
  3502.          {
  3503.             trace("Validating " + control.style + " " + control.varName + ": Valid");
  3504.          }
  3505.          control.errorMarker._visible = true;
  3506.          return false;
  3507.       }
  3508.       return true;
  3509.    };
  3510.    this.autoFillEmailbox = function(control)
  3511.    {
  3512.       var _loc1_ = SharedObject.getLocal("cmuDatacap");
  3513.       if(_loc1_.data[control.varName] != undefined)
  3514.       {
  3515.          control.instance.text = _loc1_.data[control.varName];
  3516.       }
  3517.    };
  3518.    this.registerCheckbox = function(varName, instance, errorMarker)
  3519.    {
  3520.       if(_level0.debug)
  3521.       {
  3522.          trace("Registered checkbox " + varName + " errorMarker=" + errorMarker);
  3523.       }
  3524.       if(instance == undefined)
  3525.       {
  3526.          trace("Error: Instance not found for checkbox " + varName + "");
  3527.       }
  3528.       this.controls.push({style:"checkbox",varName:varName,instance:instance,errorMarker:errorMarker,isValid:this.validateCheckbox,autoFill:this.autoFillCheckbox});
  3529.       instance.tabIndex = this.controls.length;
  3530.       instance.objForm = this;
  3531.       errorMarker._visible = false;
  3532.    };
  3533.    this.validateCheckbox = function(control)
  3534.    {
  3535.       if(control.errorMarker != undefined)
  3536.       {
  3537.          if(_level0.debug)
  3538.          {
  3539.             trace("Validating " + control.style + " " + control.varName);
  3540.          }
  3541.          if(control.instance.selected != true)
  3542.          {
  3543.             if(_level0.debug)
  3544.             {
  3545.                trace("Validating " + control.style + " " + control.varName + ": Invalid");
  3546.             }
  3547.             control.errorMarker._visible = true;
  3548.             return false;
  3549.          }
  3550.          if(_level0.debug)
  3551.          {
  3552.             trace("Validating " + control.style + " " + control.varName + ": Valid");
  3553.          }
  3554.          control.errorMarker._visible = false;
  3555.          return true;
  3556.       }
  3557.       return true;
  3558.    };
  3559.    this.autoFillCheckbox = function(control)
  3560.    {
  3561.       var _loc1_ = SharedObject.getLocal("cmuDatacap");
  3562.       if(_loc1_.data[control.varName] != undefined)
  3563.       {
  3564.          control.instance.selected = _loc1_.data[control.varName];
  3565.       }
  3566.    };
  3567.    this.registerRadioSet = function(varName, instance, errorMarker)
  3568.    {
  3569.       if(_level0.debug)
  3570.       {
  3571.          trace("Registered radioset " + varName + " errorMarker=" + errorMarker);
  3572.       }
  3573.       if(instance == undefined)
  3574.       {
  3575.          trace("Error: Instance not found for radioset " + varName + "");
  3576.       }
  3577.       this.controls.push({style:"radioset",varName:varName,instance:instance,errorMarker:errorMarker,isValid:this.validateRadioSet,autoFill:this.autoFillRadioSet});
  3578.       instance.tabIndex = this.controls.length;
  3579.       instance.objForm = this;
  3580.       errorMarker._visible = false;
  3581.    };
  3582.    this.validateRadioSet = function(control)
  3583.    {
  3584.       if(control.errorMarker != undefined)
  3585.       {
  3586.          if(control.instance.selection == undefined)
  3587.          {
  3588.             if(_level0.debug)
  3589.             {
  3590.                trace("Validating " + control.style + " " + control.varName + ": Invalid");
  3591.             }
  3592.             control.errorMarker._visible = true;
  3593.             return false;
  3594.          }
  3595.          if(_level0.debug)
  3596.          {
  3597.             trace("Validating " + control.style + " " + control.varName + ": Valid");
  3598.          }
  3599.          control.errorMarker._visible = false;
  3600.          return true;
  3601.       }
  3602.       return true;
  3603.    };
  3604.    this.autoFillRadioSet = function(control)
  3605.    {
  3606.       return undefined;
  3607.    };
  3608.    this.registerDropdown = function(varName, instance, errorMarker)
  3609.    {
  3610.       if(_level0.debug)
  3611.       {
  3612.          trace("Registered dropdown " + varName + " errorMarker=" + errorMarker);
  3613.       }
  3614.       if(instance == undefined)
  3615.       {
  3616.          trace("Error: Instance not found for dropdown " + varName + "");
  3617.       }
  3618.       this.controls.push({style:"dropdown",varName:varName,instance:instance,errorMarker:errorMarker,isValid:this.validateDropdown,autoFill:this.autoFillDropdown});
  3619.       instance.tabIndex = this.controls.length;
  3620.       instance.objForm = this;
  3621.       errorMarker._visible = false;
  3622.    };
  3623.    this.validateDropdown = function(control)
  3624.    {
  3625.       if(control.errorMarker != undefined)
  3626.       {
  3627.          if(control.instance.selectedIndex == 0)
  3628.          {
  3629.             if(_level0.debug)
  3630.             {
  3631.                trace("Validating " + control.style + " " + control.varName + ": Invalid");
  3632.             }
  3633.             control.errorMarker._visible = true;
  3634.             return false;
  3635.          }
  3636.          if(_level0.debug)
  3637.          {
  3638.             trace("Validating " + control.style + " " + control.varName + ": Valid");
  3639.          }
  3640.          control.errorMarker._visible = false;
  3641.          return true;
  3642.       }
  3643.       return true;
  3644.    };
  3645.    this.autoFillDropdown = function(control)
  3646.    {
  3647.       var _loc1_ = SharedObject.getLocal("cmuDatacap");
  3648.       if(_loc1_.data[control.varName] != undefined)
  3649.       {
  3650.          control.instance.selectedIndex = _loc1_.data[control.varName];
  3651.       }
  3652.    };
  3653.    this.registerSubmit = function(varName, instance, value)
  3654.    {
  3655.       if(_level0.debug)
  3656.       {
  3657.          trace("Registered submit button " + varName + " errorMarker=" + errorMarker);
  3658.       }
  3659.       if(instance == undefined)
  3660.       {
  3661.          trace("Error: Instance not found for submit button " + varName + "");
  3662.       }
  3663.       this.controls.push({style:"submit",varName:varName,instance:instance,value:value});
  3664.       instance.objForm = this;
  3665.       instance.tabIndex = this.controls.length;
  3666.       instance.onRelease = this.submitForm;
  3667.    };
  3668.    this.setHiddenValue = function(varName, value)
  3669.    {
  3670.       if(_level0.debug)
  3671.       {
  3672.          trace("Set hidden value " + varName + "=" + value);
  3673.       }
  3674.       var _loc3_ = undefined;
  3675.       var _loc2_ = 0;
  3676.       while(_loc2_ < this.controls.length)
  3677.       {
  3678.          if(this.controls[_loc2_].style == "hidden")
  3679.          {
  3680.             if(this.controls[_loc2_].varName == varName)
  3681.             {
  3682.                _loc3_ = _loc2_;
  3683.             }
  3684.          }
  3685.          _loc2_ = _loc2_ + 1;
  3686.       }
  3687.       if(_loc3_ == undefined)
  3688.       {
  3689.          this.controls.push({style:"hidden",varName:varName,value:value});
  3690.       }
  3691.       else
  3692.       {
  3693.          this.controls[_loc3_].value = value;
  3694.       }
  3695.    };
  3696.    this.registerFrames = function(sendingFrame, successFrame, failureFrame, formInstance)
  3697.    {
  3698.       if(_level0.debug)
  3699.       {
  3700.          trace("Registered frames for instance " + formInstance);
  3701.       }
  3702.       if(formInstance == undefined)
  3703.       {
  3704.          trace("Error: Registering frames, form instance invalid");
  3705.       }
  3706.       this.formInstance = formInstance;
  3707.       this.sendingFrame = sendingFrame;
  3708.       this.successFrame = successFrame;
  3709.       this.failureFrame = failureFrame;
  3710.    };
  3711.    this.registerCallbacks = function(customIsValid, preSubmit, onSuccess, onFailure)
  3712.    {
  3713.       if(_level0.debug)
  3714.       {
  3715.          trace("Registered callbacks");
  3716.       }
  3717.       this.customIsValid = customIsValid;
  3718.       this.preSubmit = preSubmit;
  3719.       this.onSuccess = onSuccess;
  3720.       this.onFailure = onFailure;
  3721.    };
  3722.    this.submitForm = function()
  3723.    {
  3724.       if(_level0.debug)
  3725.       {
  3726.          trace("Submit pressed - validating");
  3727.       }
  3728.       var _loc6_ = true;
  3729.       if(this.objForm.customIsValid != undefined)
  3730.       {
  3731.          if(!this.objForm.customIsValid())
  3732.          {
  3733.             _loc6_ = false;
  3734.          }
  3735.       }
  3736.       var _loc2_ = 0;
  3737.       while(_loc2_ < this.objForm.controls.length)
  3738.       {
  3739.          if(this.objForm.controls[_loc2_].isValid != undefined)
  3740.          {
  3741.             if(!this.objForm.controls[_loc2_].isValid(this.objForm.controls[_loc2_]))
  3742.             {
  3743.                _loc6_ = false;
  3744.             }
  3745.          }
  3746.          _loc2_ = _loc2_ + 1;
  3747.       }
  3748.       if(_loc6_)
  3749.       {
  3750.          if(_level0.debug)
  3751.          {
  3752.             trace("Form validated - sending");
  3753.          }
  3754.          if(_level0.debug)
  3755.          {
  3756.             trace("Submitting form");
  3757.          }
  3758.          var _loc5_ = new LoadVars();
  3759.          var _loc7_ = new LoadVars();
  3760.          _loc7_.objForm = this.objForm;
  3761.          this.objForm.preSubmit();
  3762.          var _loc4_ = SharedObject.getLocal("cmuDatacap");
  3763.          _loc2_ = 0;
  3764.          while(_loc2_ < this.objForm.controls.length)
  3765.          {
  3766.             var _loc3_ = "";
  3767.             switch(this.objForm.controls[_loc2_].style)
  3768.             {
  3769.                case "textbox":
  3770.                   _loc3_ = this.objForm.controls[_loc2_].instance.text;
  3771.                   _loc4_.data[this.objForm.controls[_loc2_].varName] = _loc3_;
  3772.                   break;
  3773.                case "emailbox":
  3774.                   _loc3_ = this.objForm.controls[_loc2_].instance.text;
  3775.                   _loc4_.data[this.objForm.controls[_loc2_].varName] = _loc3_;
  3776.                   break;
  3777.                case "checkbox":
  3778.                   _loc3_ = !this.objForm.controls[_loc2_].instance.selected ? false : true;
  3779.                   _loc4_.data[this.objForm.controls[_loc2_].varName] = _loc3_;
  3780.                   break;
  3781.                case "radioset":
  3782.                   _loc3_ = this.objForm.controls[_loc2_].instance.selection.data;
  3783.                   break;
  3784.                case "dropdown":
  3785.                   _loc3_ = this.objForm.controls[_loc2_].instance.selectedItem.data;
  3786.                   _loc4_.data[this.objForm.controls[_loc2_].varName] = this.objForm.controls[_loc2_].instance.selectedIndex;
  3787.                   break;
  3788.                case "hidden":
  3789.                   _loc3_ = this.objForm.controls[_loc2_].value;
  3790.                   break;
  3791.                case "submit":
  3792.                   _loc3_ = this.objForm.controls[_loc2_].value;
  3793.                   this.objForm.controls[_loc2_].instance._visible = false;
  3794.                   break;
  3795.                default:
  3796.                   trace("Unhandled component style " + this.objForm.controls[_loc2_].style);
  3797.             }
  3798.             if(_level0.debug)
  3799.             {
  3800.                trace("  " + this.objForm.controls[_loc2_].varName + " = " + _loc3_);
  3801.             }
  3802.             _loc5_[this.objForm.controls[_loc2_].varName] = _loc3_;
  3803.             _loc2_ = _loc2_ + 1;
  3804.          }
  3805.          _loc4_.flush();
  3806.          _loc5_.userID = this.objForm.userID;
  3807.          _loc5_.formID = this.objForm.formID;
  3808.          _loc7_.onLoad = function(success)
  3809.          {
  3810.             trace("SUCCESS: " + success);
  3811.             if(success)
  3812.             {
  3813.                if(_level0.debug)
  3814.                {
  3815.                   trace("Success");
  3816.                }
  3817.                this.objForm.onSuccess();
  3818.                if(this.objForm.formInstance != undefined)
  3819.                {
  3820.                   this.objForm.formInstance.gotoAndStop(this.objForm.successFrame);
  3821.                }
  3822.             }
  3823.             else
  3824.             {
  3825.                if(_level0.debug)
  3826.                {
  3827.                   trace("Failed");
  3828.                }
  3829.                this.objForm.onFailure();
  3830.                if(this.objForm.formInstance != undefined)
  3831.                {
  3832.                   this.objForm.formInstance.gotoAndStop(this.objForm.failureFrame);
  3833.                }
  3834.             }
  3835.          };
  3836.          var _loc8_ = this.objForm.datacapURL + (this.objForm.thirdPartySubmit != undefined ? "_" + this.objForm.thirdPartySubmit : "") + ".php";
  3837.          _loc5_.sendAndLoad(_loc8_,_loc7_,"POST");
  3838.          if(this.objForm.formInstance != undefined)
  3839.          {
  3840.             this.objForm.formInstance.gotoAndStop(this.objForm.sendingFrame);
  3841.          }
  3842.       }
  3843.       else if(_level0.debug)
  3844.       {
  3845.          trace("Form data not validated");
  3846.       }
  3847.    };
  3848.    this.autoFill = function()
  3849.    {
  3850.       var _loc2_ = 0;
  3851.       while(_loc2_ < this.controls.length)
  3852.       {
  3853.          this.controls[_loc2_].autoFill(this.controls[_loc2_]);
  3854.          _loc2_ = _loc2_ + 1;
  3855.       }
  3856.    };
  3857.    this.onKeyDown = function()
  3858.    {
  3859.       if(Key.isDown(16) && Key.isDown(17) && Key.isDown(192))
  3860.       {
  3861.          this.autoFill();
  3862.       }
  3863.    };
  3864.    Key.addListener(this);
  3865.    trace("Press ctrl+shift+@ to autofill form with previously entered values");
  3866.    this.initCountryDropDown = function(dropdownClip)
  3867.    {
  3868.       dropdownClip.addItem("Select Country","NIL");
  3869.       dropdownClip.addItem("United Kingdom","GB");
  3870.       dropdownClip.addItem("Ireland","IE");
  3871.       dropdownClip.addItem("France","FR");
  3872.       dropdownClip.addItem("Spain","ES");
  3873.       dropdownClip.addItem("Netherlands","NL");
  3874.       dropdownClip.addItem("Italy","IT");
  3875.       dropdownClip.addItem("Germany","DE");
  3876.       dropdownClip.addItem("United States","US");
  3877.       dropdownClip.addItem("Canada","CA");
  3878.       dropdownClip.addItem("---------------------","--");
  3879.       dropdownClip.addItem("Afghanistan","AF");
  3880.       dropdownClip.addItem("Albania","AL");
  3881.       dropdownClip.addItem("Algeria","DZ");
  3882.       dropdownClip.addItem("American Samoa","AS");
  3883.       dropdownClip.addItem("Andorra","AD");
  3884.       dropdownClip.addItem("Angola","AO");
  3885.       dropdownClip.addItem("Anguilla","AI");
  3886.       dropdownClip.addItem("Antarctica","AQ");
  3887.       dropdownClip.addItem("Antigua And Barbuda","AG");
  3888.       dropdownClip.addItem("Argentina","AR");
  3889.       dropdownClip.addItem("Armenia","AM");
  3890.       dropdownClip.addItem("Aruba","AW");
  3891.       dropdownClip.addItem("Australia","AU");
  3892.       dropdownClip.addItem("Austria","AT");
  3893.       dropdownClip.addItem("Azerbaijan","AZ");
  3894.       dropdownClip.addItem("Bahamas","BS");
  3895.       dropdownClip.addItem("Bahrain","BH");
  3896.       dropdownClip.addItem("Bangladesh","BD");
  3897.       dropdownClip.addItem("Barbados","BB");
  3898.       dropdownClip.addItem("Belarus","BY");
  3899.       dropdownClip.addItem("Belgium","BE");
  3900.       dropdownClip.addItem("Belize","BZ");
  3901.       dropdownClip.addItem("Benin","BJ");
  3902.       dropdownClip.addItem("Bermuda","BM");
  3903.       dropdownClip.addItem("Bhutan","BT");
  3904.       dropdownClip.addItem("Bolivia","BO");
  3905.       dropdownClip.addItem("Bosnia And Herzegowina","BA");
  3906.       dropdownClip.addItem("Botswana","BW");
  3907.       dropdownClip.addItem("Bouvet Island","BV");
  3908.       dropdownClip.addItem("Brazil","BR");
  3909.       dropdownClip.addItem("British Indian Ocean Territory","IO");
  3910.       dropdownClip.addItem("Brunei Darussalam","BN");
  3911.       dropdownClip.addItem("Bulgaria","BG");
  3912.       dropdownClip.addItem("Burkina Faso","BF");
  3913.       dropdownClip.addItem("Burundi","BI");
  3914.       dropdownClip.addItem("Cambodia","KH");
  3915.       dropdownClip.addItem("Cameroon","CM");
  3916.       dropdownClip.addItem("Cape Verde","CV");
  3917.       dropdownClip.addItem("Cayman Islands","KY");
  3918.       dropdownClip.addItem("Central African Republic","CF");
  3919.       dropdownClip.addItem("Chad","TD");
  3920.       dropdownClip.addItem("Chile","CL");
  3921.       dropdownClip.addItem("China","CN");
  3922.       dropdownClip.addItem("Christmas Island","CX");
  3923.       dropdownClip.addItem("Cocos (Keeling) Islands","CC");
  3924.       dropdownClip.addItem("Colombia","CO");
  3925.       dropdownClip.addItem("Comoros","KM");
  3926.       dropdownClip.addItem("Congo","CG");
  3927.       dropdownClip.addItem("Cook Islands","CK");
  3928.       dropdownClip.addItem("Costa Rica","CR");
  3929.       dropdownClip.addItem("Cote D\'Ivoire","CI");
  3930.       dropdownClip.addItem("Croatia (Local Name: Hrvatska)","HR");
  3931.       dropdownClip.addItem("Cuba","CU");
  3932.       dropdownClip.addItem("Cyprus","CY");
  3933.       dropdownClip.addItem("Czech Republic","CZ");
  3934.       dropdownClip.addItem("Denmark","DK");
  3935.       dropdownClip.addItem("Djibouti","DJ");
  3936.       dropdownClip.addItem("Dominica","DM");
  3937.       dropdownClip.addItem("Dominican Republic","DO");
  3938.       dropdownClip.addItem("East Timor","TP");
  3939.       dropdownClip.addItem("Ecuador","EC");
  3940.       dropdownClip.addItem("Egypt","EG");
  3941.       dropdownClip.addItem("El Salvador","SV");
  3942.       dropdownClip.addItem("Equatorial Guinea","GQ");
  3943.       dropdownClip.addItem("Eritrea","ER");
  3944.       dropdownClip.addItem("Estonia","EE");
  3945.       dropdownClip.addItem("Ethiopia","ET");
  3946.       dropdownClip.addItem("Falkland Islands (Malvinas)","FK");
  3947.       dropdownClip.addItem("Faroe Islands","FO");
  3948.       dropdownClip.addItem("Fiji","FJ");
  3949.       dropdownClip.addItem("Finland","FI");
  3950.       dropdownClip.addItem("French Guiana","GF");
  3951.       dropdownClip.addItem("French Polynesia","PF");
  3952.       dropdownClip.addItem("French Southern Territories","TF");
  3953.       dropdownClip.addItem("Gabon","GA");
  3954.       dropdownClip.addItem("Gambia","GM");
  3955.       dropdownClip.addItem("Georgia","GE");
  3956.       dropdownClip.addItem("Ghana","GH");
  3957.       dropdownClip.addItem("Gibraltar","GI");
  3958.       dropdownClip.addItem("Greece","GR");
  3959.       dropdownClip.addItem("Greenland","GL");
  3960.       dropdownClip.addItem("Grenada","GD");
  3961.       dropdownClip.addItem("Guadeloupe","GP");
  3962.       dropdownClip.addItem("Guam","GU");
  3963.       dropdownClip.addItem("Guatemala","GT");
  3964.       dropdownClip.addItem("Guinea","GN");
  3965.       dropdownClip.addItem("Guinea-Bissau","GW");
  3966.       dropdownClip.addItem("Guyana","GY");
  3967.       dropdownClip.addItem("Haiti","HT");
  3968.       dropdownClip.addItem("Heard And Mc Donald Islands","HM");
  3969.       dropdownClip.addItem("Holy See (Vatican City State)","VA");
  3970.       dropdownClip.addItem("Honduras","HN");
  3971.       dropdownClip.addItem("Hong Kong","HK");
  3972.       dropdownClip.addItem("Hungary","HU");
  3973.       dropdownClip.addItem("Icel And","IS");
  3974.       dropdownClip.addItem("India","IN");
  3975.       dropdownClip.addItem("Indonesia","ID");
  3976.       dropdownClip.addItem("Iran (Islamic Republic Of)","IR");
  3977.       dropdownClip.addItem("Iraq","IQ");
  3978.       dropdownClip.addItem("Israel","IL");
  3979.       dropdownClip.addItem("Jamaica","JM");
  3980.       dropdownClip.addItem("Japan","JP");
  3981.       dropdownClip.addItem("Jordan","JO");
  3982.       dropdownClip.addItem("Kazakhstan","KZ");
  3983.       dropdownClip.addItem("Kenya","KE");
  3984.       dropdownClip.addItem("Kiribati","KI");
  3985.       dropdownClip.addItem("Korea, Dem People\'S Republic","KP");
  3986.       dropdownClip.addItem("Korea, Republic Of","KR");
  3987.       dropdownClip.addItem("Kuwait","KW");
  3988.       dropdownClip.addItem("Kyrgyzstan","KG");
  3989.       dropdownClip.addItem("Lao People\'S Dem Republic","LA");
  3990.       dropdownClip.addItem("Latvia","LV");
  3991.       dropdownClip.addItem("Lebanon","LB");
  3992.       dropdownClip.addItem("Lesotho","LS");
  3993.       dropdownClip.addItem("Liberia","LR");
  3994.       dropdownClip.addItem("Libyan Arab Jamahiriya","LY");
  3995.       dropdownClip.addItem("Liechtenstein","LI");
  3996.       dropdownClip.addItem("Lithuania","LT");
  3997.       dropdownClip.addItem("Luxembourg","LU");
  3998.       dropdownClip.addItem("Macau","MO");
  3999.       dropdownClip.addItem("Macedonia","MK");
  4000.       dropdownClip.addItem("Madagascar","MG");
  4001.       dropdownClip.addItem("Malawi","MW");
  4002.       dropdownClip.addItem("Malaysia","MY");
  4003.       dropdownClip.addItem("Maldives","MV");
  4004.       dropdownClip.addItem("Mali","ML");
  4005.       dropdownClip.addItem("Malta","MT");
  4006.       dropdownClip.addItem("Marshall Islands","MH");
  4007.       dropdownClip.addItem("Martinique","MQ");
  4008.       dropdownClip.addItem("Mauritania","MR");
  4009.       dropdownClip.addItem("Mauritius","MU");
  4010.       dropdownClip.addItem("Mayotte","YT");
  4011.       dropdownClip.addItem("Mexico","MX");
  4012.       dropdownClip.addItem("Micronesia, Federated States","FM");
  4013.       dropdownClip.addItem("Moldova, Republic Of","MD");
  4014.       dropdownClip.addItem("Monaco","MC");
  4015.       dropdownClip.addItem("Mongolia","MN");
  4016.       dropdownClip.addItem("Montserrat","MS");
  4017.       dropdownClip.addItem("Morocco","MA");
  4018.       dropdownClip.addItem("Mozambique","MZ");
  4019.       dropdownClip.addItem("Myanmar","MM");
  4020.       dropdownClip.addItem("Namibia","NA");
  4021.       dropdownClip.addItem("Nauru","NR");
  4022.       dropdownClip.addItem("Nepal","NP");
  4023.       dropdownClip.addItem("Netherlands Ant Illes","AN");
  4024.       dropdownClip.addItem("New Caledonia","NC");
  4025.       dropdownClip.addItem("New Zealand","NZ");
  4026.       dropdownClip.addItem("Nicaragua","NI");
  4027.       dropdownClip.addItem("Niger","NE");
  4028.       dropdownClip.addItem("Nigeria","NG");
  4029.       dropdownClip.addItem("Niue","NU");
  4030.       dropdownClip.addItem("Norfolk Island","NF");
  4031.       dropdownClip.addItem("Northern Mariana Islands","MP");
  4032.       dropdownClip.addItem("Norway","NO");
  4033.       dropdownClip.addItem("Oman","OM");
  4034.       dropdownClip.addItem("Pakistan","PK");
  4035.       dropdownClip.addItem("Palau","PW");
  4036.       dropdownClip.addItem("Panama","PA");
  4037.       dropdownClip.addItem("Papua New Guinea","PG");
  4038.       dropdownClip.addItem("Paraguay","PY");
  4039.       dropdownClip.addItem("Peru","PE");
  4040.       dropdownClip.addItem("Philippines","PH");
  4041.       dropdownClip.addItem("Pitcairn","PN");
  4042.       dropdownClip.addItem("Poland","PL");
  4043.       dropdownClip.addItem("Portugal","PT");
  4044.       dropdownClip.addItem("Puerto Rico","PR");
  4045.       dropdownClip.addItem("Qatar","QA");
  4046.       dropdownClip.addItem("Reunion","RE");
  4047.       dropdownClip.addItem("Romania","RO");
  4048.       dropdownClip.addItem("Russian Federation","RU");
  4049.       dropdownClip.addItem("Rwanda","RW");
  4050.       dropdownClip.addItem("Saint K Itts And Nevis","KN");
  4051.       dropdownClip.addItem("Saint Lucia","LC");
  4052.       dropdownClip.addItem("Saint Vincent, The Grenadines","VC");
  4053.       dropdownClip.addItem("Samoa","WS");
  4054.       dropdownClip.addItem("San Marino","SM");
  4055.       dropdownClip.addItem("Sao Tome And Principe","ST");
  4056.       dropdownClip.addItem("Saudi Arabia","SA");
  4057.       dropdownClip.addItem("Senegal","SN");
  4058.       dropdownClip.addItem("Seychelles","SC");
  4059.       dropdownClip.addItem("Sierra Leone","SL");
  4060.       dropdownClip.addItem("Singapore","SG");
  4061.       dropdownClip.addItem("Slovakia (Slovak Republic)","SK");
  4062.       dropdownClip.addItem("Slovenia","SI");
  4063.       dropdownClip.addItem("Solomon Islands","SB");
  4064.       dropdownClip.addItem("Somalia","SO");
  4065.       dropdownClip.addItem("South Africa","ZA");
  4066.       dropdownClip.addItem("South Georgia , S Sandwich Is.","GS");
  4067.       dropdownClip.addItem("Sri Lanka","LK");
  4068.       dropdownClip.addItem("St. Helena","SH");
  4069.       dropdownClip.addItem("St. Pierre And Miquelon","PM");
  4070.       dropdownClip.addItem("Sudan","SD");
  4071.       dropdownClip.addItem("Suriname","SR");
  4072.       dropdownClip.addItem("Svalbard, Jan Mayen Islands","SJ");
  4073.       dropdownClip.addItem("Sw Aziland","SZ");
  4074.       dropdownClip.addItem("Sweden","SE");
  4075.       dropdownClip.addItem("Switzerland","CH");
  4076.       dropdownClip.addItem("Syrian Arab Republic","SY");
  4077.       dropdownClip.addItem("Taiwan","TW");
  4078.       dropdownClip.addItem("Tajikistan","TJ");
  4079.       dropdownClip.addItem("Tanzania, United Republic Of","TZ");
  4080.       dropdownClip.addItem("Thailand","TH");
  4081.       dropdownClip.addItem("Togo","TG");
  4082.       dropdownClip.addItem("Tokelau","TK");
  4083.       dropdownClip.addItem("Tonga","TO");
  4084.       dropdownClip.addItem("Trinidad And Tobago","TT");
  4085.       dropdownClip.addItem("Tunisia","TN");
  4086.       dropdownClip.addItem("Turkey","TR");
  4087.       dropdownClip.addItem("Turkmenistan","TM");
  4088.       dropdownClip.addItem("Turks And Caicos Islands","TC");
  4089.       dropdownClip.addItem("Tuvalu","TV");
  4090.       dropdownClip.addItem("Uganda","UG");
  4091.       dropdownClip.addItem("Ukraine","UA");
  4092.       dropdownClip.addItem("United Arab Emirates","AE");
  4093.       dropdownClip.addItem("United States Minor Is.","UM");
  4094.       dropdownClip.addItem("Uruguay","UY");
  4095.       dropdownClip.addItem("Uzbekistan","UZ");
  4096.       dropdownClip.addItem("Vanuatu","VU");
  4097.       dropdownClip.addItem("Venezuela","VE");
  4098.       dropdownClip.addItem("Viet Nam","VN");
  4099.       dropdownClip.addItem("Virgin Islands (British)","VG");
  4100.       dropdownClip.addItem("Virgin Islands (U.S.)","VI");
  4101.       dropdownClip.addItem("Wallis And Futuna Islands","WF");
  4102.       dropdownClip.addItem("Western Sahara","EH");
  4103.       dropdownClip.addItem("Yemen","YE");
  4104.       dropdownClip.addItem("Yugoslavia","YU");
  4105.       dropdownClip.addItem("Zaire","ZR");
  4106.       dropdownClip.addItem("Zambia","ZM");
  4107.       dropdownClip.addItem("Zimbabwe","ZW");
  4108.       dropdownClip.setSelectedIndex(0);
  4109.    };
  4110.    this.initMobilesDropdown = function(dropdownClip)
  4111.    {
  4112.       mobiles = new Array();
  4113.       dropdownClip.addItem("Select manufacturer","NIL");
  4114.       dropdownClip.addItem("NOKIA","NOKIA");
  4115.       dropdownClip.addItem("MOTOROLA","MOTOROLA");
  4116.       dropdownClip.addItem("SAMSUNG","SAMSUNG");
  4117.       dropdownClip.addItem("SONY ERICSSON","ERICSSON");
  4118.       dropdownClip.addItem("ALCATEL","ALCATEL");
  4119.       dropdownClip.addItem("LG","LG");
  4120.       dropdownClip.addItem("NEC","NEC");
  4121.       dropdownClip.addItem("PANASONIC","PANASONIC");
  4122.       dropdownClip.addItem("SAGEM","SAGEM");
  4123.       dropdownClip.addItem("SIEMENS","SIEMENS");
  4124.       dropdownClip.addItem("SHARP","SHARP");
  4125.       dropdownClip.addItem("TRIUM","TRIUM");
  4126.       dropdownClip.addItem("HANDSPRING","HANDSPRING");
  4127.       dropdownClip.addItem("POGO","POGO");
  4128.       dropdownClip.setSelectedItem(0);
  4129.    };
  4130.    this.initDateDropdowns = function(dropdownYear, dropdownMonth, dropdownDay)
  4131.    {
  4132.       dropdownDay.addItem("DD");
  4133.       var _loc1_ = 1;
  4134.       while(_loc1_ <= 31)
  4135.       {
  4136.          dropdownDay.addItem(_loc1_,_loc1_);
  4137.          _loc1_ = _loc1_ + 1;
  4138.       }
  4139.       dropdownDay.setSelectedIndex(0);
  4140.       dropdownMonth.addItem("MM");
  4141.       _loc1_ = 1;
  4142.       while(_loc1_ <= 12)
  4143.       {
  4144.          dropdownMonth.addItem(_loc1_,_loc1_);
  4145.          _loc1_ = _loc1_ + 1;
  4146.       }
  4147.       dropdownMonth.setSelectedIndex(0);
  4148.       dropdownYear.addItem("YYYY");
  4149.       _loc1_ = 2007;
  4150.       while(_loc1_ >= 1900)
  4151.       {
  4152.          dropdownYear.addItem(_loc1_,_loc1_);
  4153.          _loc1_ = _loc1_ - 1;
  4154.       }
  4155.       dropdownYear.setSelectedIndex(0);
  4156.    };
  4157. };
  4158. initSounds();
  4159. _root.objSounds.play("voice-title");
  4160. var objSO = SharedObject.getLocal("hannainachoppa");
  4161. if(objSO.data.controls == undefined)
  4162. {
  4163.    objSO.data.sensitivity = "normal";
  4164.    objSO.data.controls = "easy";
  4165.    objSO.flush();
  4166. }
  4167. _root.controls = objSO.data.controls;
  4168. _root.sensitivity = objSO.data.sensitivity;
  4169. reportAllStatistics(true);
  4170.